akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
	int n,k,x,y;
	
	cin >> n >> k;
	for(int i = 0; i < k; i++){
		cin >> x >> y;
		
		if(x > (n+1)/2){
			x = n + 1 - x;
		}
		if(y > (n+1)/2){
			y = n + 1 - y;
		}
		
		//cout << ((((x<y)?x:y)%3)?(((x<y)?x:y)%3):3) << endl;
		
		if(x < y){
			if(x % 3){
				cout << x % 3 << endl;
			}else{
				cout << 3 << endl;
			}
		}else{
			if(y % 3){
				cout << y % 3 << endl;
			}else{
				cout << 3 << endl;
			}
		}
		
	}
	
	return 0;
}

Measured memory_bytes: 0
readInt :: String -> Int
readInt = read

main = do
 [q,h,s,d] <- (map readInt . words) <$> getLine
 n <- readInt <$> getLine
 print $ analyze (q,h,s,d) n


analyze (q,h,s,d) n = (n `div` 2) * min_d + (n `mod` 2) * min_s
 where
  min_d = min (min_s*2) d
  min_s = min (min_h*2) s
  min_h = min (min_q*2) h
  min_q = q


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

using namespace std;
typedef long long ll;

int solve(int x) {
  if(x==1) {
    return 1;
  }
  int res = 0;
  for(int i = 2;pow(i, 2) <=x;i++) {
    for(int j=2;pow(i, j)<=x;j++) {
      res = max(res, (int) pow(i,j));
    }
  }
  return res;
}

int main() {
  int x;
  cin >> x;
  cout << solve(x);
}

Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;


int main() {
  string s;
  cin >> s;
  int sI;
  int zI;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    if (s.at(i) == 'A') {
      sI = i;
      break;
    }
  }
  for (int i = n - 1; i > 0; i--) {
    if (s.at(i) == 'Z') {
      zI = i;
      break;
    } 
  }
  cout << zI - sI + 1 << endl;
}


Measured memory_bytes: 640
N = int(input())
X = list(map(int, input().split()))

sx = sorted(X)
mid1 = sx[N//2-1]
mid2 = sx[N//2]

if mid1 == mid2:
    print(*[mid1]*N, sep='\n')
else:
    for i in range(N):
        if X[i] <= mid1:
            print(mid2)
        else:
            print(mid1)

Measured memory_bytes: 94284
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

d = {}
v = 0
ans = []

for a in A:
    d[a] = d.get(a, 0) + 1
    v += a

for i in range(Q):
    B, C = map(int, input().split())
    v += d.get(B, 0) * (C - B)
    d[C] = d.get(C, 0) + d.get(B, 0)
    d[B] = 0
    ans.append(v)

for a in ans:
    print(a)




Measured memory_bytes: 26764
#include<iostream>
#include<algorithm>
using namespace std;
int n;
double v[51];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>v[i];
	sort(v+1,v+n+1);
	for(int i=2;i<=n;i++)
		v[i]=(v[i]+v[i-1])/2;
	cout<<v[n];
	cout<<"\n"; 
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, Counter

if __name__ == "__main__":
    count = int(input().strip())
    votes = defaultdict(int)
    for _ in range(count):
        vote = input().strip()
        votes[vote] += 1
    ordered_votes = Counter(votes).most_common()
    max_votes = ordered_votes[0][1]
    winners = []
    for candidate, vote in ordered_votes:
        if vote  == max_votes:
            winners.append(candidate)
        else:
            break
    
    for name in sorted(winners):
        print(name)

Measured memory_bytes: 55772
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%MOD;
        }
        x = (x*x)%MOD;
        n >>= 1;
    }
    return ret;
}

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

    vector<ll> a(3),b(3);

    for(int i = 0; i < 3; i++){
        cin >> a[i];
    }
    for(int i = 0; i < 3; i++){
        cin >> b[i];
    }

    vector<vector<ll>> dp(4,vector<ll>(n+1,0));
    vector<ll> w1 = {a[0],a[1],a[2]};
    vector<ll> v1 = {b[0],b[1],b[2]};

    for(int i = 1; i < 4; i++){
        for(int j = 0; j < n+1; j++){
            dp[i][j] = dp[i-1][j];
        }
        for(int j = 0; j < n+1; j++){
            if(j - w1[i-1] >= 0){
                dp[i][j] = max(dp[i][j-w1[i-1]] + v1[i-1],dp[i][j]);
            }
        }
    }

    ll nt = 0;
    for(int i = 0; i < n+1; i++){
        nt = max(nt, n - i + dp[3][i]);
    }

    cerr << nt << endl;

    ll nextN = max(n,nt);

    vector<vector<ll>> dp2(4,vector<ll>(nextN+1,0));
    vector<ll> w2 = {b[0],b[1],b[2]};
    vector<ll> v2 = {a[0],a[1],a[2]};

    for(int i = 1; i < 4; i++){
        for(int j = 0; j < nextN+1; j++){
            dp2[i][j] = dp2[i-1][j];
        }
        for(int j = 0; j < nextN+1; j++){
            if(j - w2[i-1] >= 0){
                dp2[i][j] = max(dp2[i][j],dp2[i][j-w2[i-1]] + v2[i-1]);
            }
        }
    }

    ll ans = 0;
    for(int i = 0; i < nextN+1; i++){
        ans = max(nextN - i + dp2[3][i],ans);
    }

    cout << max(n,max(nextN,ans)) << endl;

    return 0;
}

Measured memory_bytes: 977024
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <cmath>
#include <map>

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

using Pll  = pair<ll, ll>;
using Pull = pair<ull, ull>;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple

#define F first
#define S second

#define rep( i, n ) for ( int i = 0; i < (int)( n ); ++i )
#define reps( i, n ) for ( int i = 1; i <= (int)( n ); ++i )
#define rrep( i, n ) for ( int i = (int)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( int i = (int)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

const ll MOD = 1000000007LL;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

template<typename T = ll> class UnionFind {
public:
	UnionFind( T n ) { rep( i, n ) { par[i] = i; siz[i] = 1; } }
	T find( T x ) { if ( x == par[x] ) return ( x ); else return( par[x] = find( par[x] ) ); }
	void unite( T x, T y ) { T xx = find( x ); T yy = find( y ); if ( xx == yy ) return;
		if ( siz[xx] <= siz[yy] ) swap( xx, yy ); par[yy] = xx; siz[xx] += siz[yy]; }
private:
	vector<T> par, siz;
};

template<typename T = ll> T binpow( T a, T b, T m = MOD ) {
	T res = 1;
	while ( b > 0 ) { if ( b & 1 ) res = res * a % m;
		a = a * a % m; b >>= 1; }
	return ( res );
}


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

	ll cnt = 0;
	rep( i, S.size() )
	{
		if ( S[i] == 'x' )
		{
			cnt++;
		}
	}

	cout << ( ( cnt <= 7 ) ? "YES" : "NO" ) << endl;
	
	return ( 0 );
}


Measured memory_bytes: 888
#include <math.h>

#include <algorithm>
#include <iostream>
#include <vector>

using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using namespace std;

// 137 -c
struct Point {
    int x, y;
};

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

    vector<Point> pointList(n);
    vector<int> pIdxList(n);
    rep(i, 0, n) {
        cin >> pointList[i].x >> pointList[i].y;
        pIdxList[i] = i;
    }

    vector<vector<double>> len(n, vector<double>(n));
    rep(i, 0, n) {
        rep(j, i + 1, n) {
            int lx    = pointList[i].x - pointList[j].x;
            int ly    = pointList[i].y - pointList[j].y;
            double l  = sqrt(lx * lx + ly * ly);
            len[i][j] = l;
            len[j][i] = l;
        }
    }

    int cnt    = 0;
    double sum = 0;
    do {
        double idxLen = 0;
        rep(i, 0, pIdxList.size() - 1) {
            idxLen += len[pIdxList[i]][pIdxList[i + 1]];
        }
        sum += idxLen;
        cnt++;
    } while (next_permutation(pIdxList.begin(), pIdxList.end()));

    printf("%lf\n", sum / cnt);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_set>

using namespace std;

int main()
{
	unordered_set<string> dict;

	int n;
	cin >> n;

	while (n--) {
		string op, str;
		cin >> op >> str;
		if (op.at(0) == 'i') {
			dict.insert(str);
		} else {
			cout << (dict.find(str) != dict.end() ? "yes" : "no") << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 30052
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long x;
  cin >> x;
  for(int i = 0; i < 120; i++){
    for(int j = -100; j < 120; j++){
      if(i*i*i*i*i-j*j*j*j*j==x){
        cout << i << " " << j;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// debug
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}
#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif


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

  string S[2*N];
  rep(i, N) {
    cin >> S[i];
    S[i+N] = S[i] = S[i] + S[i];
  }

  int ans = 0;
  rep(A, N) {
    bool flag = true;
    rep(i, N) rep(j, N) {
      if (S[i+A][j] != S[j+A][i])
        flag = false;
    }
    if (flag)
      ++ans;
  }
  cout << ans * N << endl;

  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define fi first
#define se second

int32_t main()
{
	set<int> S;
	for(int i = 0; i < 3; i++)
	{
		int x;
		cin >> x;
		S.insert(x);
	}
	puts(S.size() == 2 ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	 int a,b; cin>>a>>b;
	if(a==0){
		if(b==100)b++;
		cout<<b<<endl;
		return 0;
	}
	int ans=b;
	rep(i,0,a)ans*=100;
	if(100==b){
		int c=100;
		if(a==2) c*=c;
		ans+=c;
	}
	cout<<ans<<endl;
		
	
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int a = n/1000;
  int b = n%1000/100;
  int c = n%100/10;
  int d = n%10;
  if (a == b && a == c) {
    cout << "Yes" << endl;
  }
  else {
    if (b == c && b == d) {
    cout << "Yes" << endl;
    }
    else cout << "No" << endl;
  }
}

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

int main()
{
	int N, A, B;
	cin >> N >> A >> B;
	auto calc = [](int x)
	{
		int sum = 0;
		while (x) {
			sum += x % 10;
			x /= 10;
		}
		return sum;
	};
	int result = 0;
	for (int n = 1; n <= N; ++n) {
		auto sum = calc(n);
		if (A <= sum && sum <= B)
			result += n;
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
#define w(x) int x; cin>>x; while(x--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;
int main(){
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	string s,t;
	cin>>s>>t;
	ll c=0;
	for(ll i=0; i<3; i++){
		if(s[i]==t[i])
			c++;
	}
	cout<<c;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>
int main()
{
	int a,b,c;
	char s1[200],s2[200];


		while(scanf("%s",s1)!=EOF){
					int flag=0;
				scanf("%s",s2);
		int n1=strlen(s1),n2=strlen(s2);
		for(int i=0;i<n1;i++){
			int k=0;
			for(int j=0;j<n1;j++){
				int n=i+j;
				if(n>=n1){
					n=n-n1;
				}
				// printf("%c %c %d %d\n",s1[(i+j+1)%3-1],s2[j-1],(i+j+1)%3-1,j);
				if(s1[n]==s2[j]){
					k++;
				}
			}
			if(k==n1){
				flag=1;
				break;
			}
		}

		if(flag)
		printf("Yes\n");
		else
		printf("No\n");
	}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef pair<int, int> PII;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const int INF = numeric_limits<int>::max();
int main()
{
  
	int row{}, col{};//行,列
	int sy{},sx{};//スタート地点の座標(y,x)
	int gy{},gx{};//ゴール地点の座標(y,x)
	cin >> row >> col;
	char C[row+1][col+1];
	char CC[row+1][col+1];
	int ll=col,kk=row;
	
	REP( i, row )
	{
		REP( j, col )
		{
			cin >> CC[i+1][j+1];//座標は1,1から始まるので+1して合わせる
		}
	}

	REP( i, row )
	{
		REP( j, col )
		{
			C[i+1][j+1]= CC[i+1][j+1];//座標は1,1から始まるので+1して合わせる
		}
	}
	int cnt=0;
	REP( i, row )
	{
		REP( j, col )
		{
			if(C[i+1][j+1]=='.')cnt++;
		}
	}
	int ans=0;
	int ii=1,jj=1;

	int distance[row+1][col+1];//距離格納配列
	REP(i,row+1)REP(j,col+1)distance[i][j]=INF;//配列初期化
	queue<PII> q;
	q.emplace( ii, jj );//スタート地点座標をqueueに代入
	distance[ii][jj] = 0;//初期状態からの距離を0に設定

	int dy[4] = { 1, 0, -1, 0 }, dx[4] = { 0, 1, 0, -1 };//移動4方向のベクトル

	while( !q.empty() )
	{
		PII now = q.front();//現在地
		q.pop();

		//移動4方向をループ
		REP( i, 4 )
		{
			//移動した後の点を(ny,nx)とする
			int ny = now.first + dy[i], nx = now.second + dx[i];

			//移動が可能かの判断と既に訪れた事があるかの判定
			if( 1<= ny && ny <= row && 1 <= nx && nx <= col && C[ny][nx] != '#' && distance[ny][nx] == INF )
			{
				q.emplace( ny, nx );//次の位置をqueueに入れる
				distance[ny][nx] = distance[now.first][now.second] + 1;//点の距離をnowから+1の距離で確定する                
			}   
		}
	}
	ans=distance[kk][ll];
	
	//if(ii==3&&jj==1&&kk==1&&ll==5)cout << distance[kk][ll] << endl;
	C[ii][jj]=CC[ii][jj];
    C[kk][ll]=CC[kk][ll];
    
  if(ans==INF)std::cout << -1 << std::endl;
  else std::cout << cnt-ans-1 << std::endl;
  
}


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

int main() {
  int a, b;
  int sum;
  cin >> a >> b;
  
  sum = a+b;
  if (sum%2 == 0) {
    cout << sum/2 << endl;
  } else {
  	cout << sum/2 + 1<< endl;
  }
}

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;


int main(){
  int n;
  cin>>n;
  int a[n];
  int b[n];
  int flag=0;
  REP(i,n){
    int k;
    cin>>k;
    a[i]=k;
    b[i]=k;
  }
  sort(b,b+n);
  int max=b[n-1];
  int count=-1;
  int j=n-1;
  int max2=max;
  while(b[j]==max){
    j--;
    count++;
  }
  max2=b[j];
  if(count>0){
    REP(i,n){
      cout<<max<<endl;
    }
  }else{
    REP(i,n){
      if(a[i]==max){
        cout<<max2<<endl;
      }else{
        cout<<max<<endl;
      }
    }
  }
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
#define itn int

int main(void){
    string s,t = "hi";
    cin >> s;
    bool check = true;
    for(int i = 0;i < s.size();i+=2){
        if(s.substr(i,2) != t)check = false;
    }
    if(s.size() == 1)check = false;
    if(check)cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 256
n = gets.to_i
h = Hash.new(0)
(1..n).each do
    x, y = gets.split.map(&:to_i)
    t = x + y
    loop do
        h[t] += 1
        if h[t] == 2
            h.delete(t)
            t += 1
        else
            break
        end
    end
end
h.keys.sort.each {|k| puts "#{k} 0"}


Measured memory_bytes: 11340
import java.util.Scanner;

public class Main {

	public static void main (String[] args)  {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[][]graph = new int[n][n];

		for (int i=0;i<n;i++) {
			String s = sc.next();
			for (int j=0;j<n;j++) {
				graph[i][j]=s.charAt(j)-'0';
			}
		}

		int[]color = new int[n];
		if(!dfs(graph,color,1,0)) {
			System.out.println(-1);
		} else {
			int[][] dist = new int[n][n];
			for (int i=0;i<n;i++) {
				for(int j=0;j<n;j++) {
					if (graph[i][j]==1){
						dist[i][j]=1;
					} else {
						dist[i][j]=n*2;
					}

				}
			}

			for (int k=0;k<n;k++) {
				for (int i=0;i<n;i++) {
					for (int j=0;j<n;j++) {
						if (dist[i][j]>dist[i][k]+dist[k][j]) {
							dist[i][j]=dist[i][k]+dist[k][j];
						}
					}
				}
			}

			int len = 0;
			for (int i=0;i<n;i++) {
				for (int j=0;j<n;j++) {
					if (i!=j) {
					len=Math.max(len, dist[i][j]);
					}
				}
			}
			System.out.println(len+1);
		}
	}

	static boolean dfs (int[][] graph, int[]color, int colorNow, int point) {

		color[point]=colorNow;
		for (int i=0;i<color.length;i++) {
			if (graph[point][i]==1) {
				if (color[i]==0) {
					if (!dfs(graph,color,-colorNow,i)) {
						return false;
					}
				} else if (color[i]==colorNow) {
					return false;
				}
			}
		}

		return true;
	}


}


Measured memory_bytes: 25936
n, a, b, c, d = map(int, input().split())
s = input()
sac = s[a-1:c]
sbd = s[b-1:d]
ac = "##" not in sac
bd = "##" not in sbd
if c < d:
    if ac and bd:
        print("Yes")
    else:
        print("No")
else:
    sbd2 = s[b-2:d+1]
    if ac and bd and "..." in sbd2:
        print("Yes")
    else:
        print("No")

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

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = 0;

    if (a == b && b == c) {
        if (a % 2 == 0)
            cout << -1 << endl;
        else
            cout << 0 << endl;

        return 0;
    }

    while (1) {
        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1)
            break;
        ll n_a, n_b, n_c;
        n_a = b / 2 + c / 2;
        n_b = a / 2 + c / 2;
        n_c = a / 2 + b / 2;
        ans++;
        a = n_a, b = n_b, c = n_c;
    }

    cout << ans << endl;
    return 0;
}


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();

        int h[] = new int[n];
        int viewableCnt = 0;

        for (int i = 0; i < n; i++) {
            h[i] = sc.nextInt();
            for (int j = (i-1); j >= 0; j--) {
                if (h[i] < h[j]){
                    break;
                } else if (j == 0) {
                    viewableCnt++;
                }
            }
        }
        System.out.println(viewableCnt + 1);
        sc.close();
    }
}


Measured memory_bytes: 21844
///#pragma GCC optimize("Ofast")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
///#pragma GCC optimize("unroll-loops")

#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;
///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<bool> vbb;

const ll N = 200001;
const ll MOD = 1000000007;
const ll INF = LLONG_MAX;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rev(a) reverse(all(a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'
#define PI acos(-1)
#define Case(x) cout<<"Case "<<x<<": "
#define strtoint(a) atoi(a.c_str())

#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;
#define cinv(v) for(auto &it:v)cin>>it;

vbb vis(N);
vii v,ans;
int head=0;
void dfs(ll x)
{
    //cout<<x<<nl;
    if(vis[x])
    {
        head=x;
        return;
    }
    ans.pb(x);
    vis[x]=true;
    dfs(v[x-1]);
}


int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    ll tc=1,cs=0;
    //cin>>tc;
    while(tc--)
    {
        ll n,k,i;
        cin>>n>>k;
        v.resize(n);
        cinv(v);
        dfs(v[head]);
        if(k<=ans.size())
        {
            cout<<ans[k-1]<<nl;
            return 0;
        }
        k-=ans.size();
        fill(all(vis),false);
        ans.clear();
        dfs(head);
        k%=(ll)ans.size();
        if(k==0)
            k=ans.size();
        cout<<ans[k-1]<<nl;
    }
}


Measured memory_bytes: 17160
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数
ll n;

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}
int isOK(ll mid) {
	if (mid*mid>n) return 1;
	else return 0;
}

ll binary_search(ll key) {
	ll s = -1;
	ll l = Minl(key,1e6);

	while (l - s > 1) {
		ll mid = (l + s) / 2;

		if (isOK(mid)) l = mid;
		else s = mid;
	}
	return l;
}

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

	ll sq = binary_search(n);
	//PRINTL(sq);
	ll ans = 0;
	REPS(i, sq) {
		if ((n - i) % i == 0 && (n-i) /i >i ) {
			ans += (n - i) / i;
			//printf("i=%d ans=%lld +%lld\n",i, ans, (n - i)/i);
		}
	}

	PRINTL(ans);
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		for(int i=0;i<N;i++){
			A[i] = sc.nextInt();
		}
		bubbleSort(A,N);
	}
	public static void bubbleSort(int[] A,int N){
		int flag = 1,count=0;
		while(flag==1){
			flag = 0;
			int i=0;
			for(int j=i;j<N-1;j++){
				if(A[j+1]<A[j]){
					int c = A[j+1];
					A[j+1] = A[j];
					A[j] = c;
					count++;
					flag = 1;
				}
			}
			i++;
		}
		for(int i=0;i<N;i++){
			System.out.print(A[i]);
			if(i!=N-1)System.out.print(" ");
		}
		System.out.printf("\n%d\n",count);
	}
}


Measured memory_bytes: 26428
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        System.out.println(gcd(x, y));
        sc.close();
    }

    public static int gcd(int x, int y) {
        if(x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }
        while(y > 0) {
            int tmp = x;
            x = y;
            y = tmp % y;
        }
        return x;
    }
}


Measured memory_bytes: 26388
var [A, B, C, D] = require('fs').readFileSync('/dev/stdin', 'utf8').split(' ').map(Number)
var ans
while (true) {
  C -= B
  if (C <= 0) {
    ans = 'Yes'
    break
  }
  A -= D
  if (A <= 0) {
    ans = 'No'
    break
  }
}
console.log(ans)

Measured memory_bytes: 29588
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    i64 n, x;
    std::cin >> n >> x;

    std::vector<std::vector<i64>> dp(51, std::vector<i64>(2501));
    dp[0][0] = 1;
    for (int i = 0; i < n; i++) {
        int a;
        std::cin >> a;
        decltype(dp) next(51, std::vector<i64>(2501));
        for (int j = 0; j <= i; j++) for (int s = 0; s + a <= 2500; s++) {
            next[j][s] += dp[j][s];
            next[j + 1][s + a] += dp[j][s];
        }
        std::swap(dp, next);
    }

    i64 ret = 0;
    for (int i = 1; i <= n; i++) {
        ret += dp[i][i * x];
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 2316
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#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,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define __builtin_popcount __builtin_popcountll

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
    os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
    os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;

int main(int argc, char *argv[]){
    ios::sync_with_stdio(false);
    cin >> n >> m;
    ll ans = 0;
    for(int b=m+1;b<=n;b++) {
        // x % b >= m
        ans += (n / b) * (b - m);
        ans += max(0, (n % b) - m + 1);
    }
    if (m == 0) ans -= n;
    cout << ans << endl;
    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> s(n);
  vector<ll> t(m);
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < m; i++) cin >> t[i];

  vector<vector<ll>> dp(n + 1, vector<ll>(m + 1));

  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 0; i <= m; i++) dp[0][i] = 1;

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i - 1] == t[j - 1]) {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
      } else {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + MOD) % MOD;
      }
    }
  }

  cout << dp[n][m] << endl;
}


Measured memory_bytes: 31616
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			System.out.println(N * N);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 22228
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int A,B,C;

signed main(){

    in(A,B,C);
    out(min(B/A,C));

    return 0;
}


Measured memory_bytes: 256
A = input()
n = len(A)
i = 1
ans = ''

def check(i, a, ans):
    if i == n:
        if eval(a) == 7:
            ans = a
        return ans
    
    else:
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '+' + a[p:]
        ans = check(i+1, a, ans)
        
        a = a[:2*i-2] + A[i-1:]
        p = i + a.count('+') + a.count('-')
        a = a[:p] + '-' + a[p:]
        ans = check(i+1, a, ans)
    return ans

ans = check(i, A, ans) 
print(ans+'=7')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
//priority_queue<ll, vector<ll>, std::greater<ll> > q;
#define ull 		unsigned long long
#define ll 			long long
#define M 			1000000007
#define pb 			emplace_back
#define p_q 		priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) // gcd((a),(b))
#define ios	    	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp 			make_pair
#define lb 			lower_bound
#define ub			upper_bound
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ini(a,n,b)	for(ll int i=0;i<n;i++) a[i]=0;
#define hell 		(ull)1e9
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
using namespace std;
//ll maxi = 3005;
ll dp[3005][3005];
void boost()
{
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
    cout.tie(NULL);
}



int main(void)
{
    boost();
    ll n;
    cin>>n;
    vi v(n);
    rep(i,0,n)
        cin>>v[i];
    
    for (ll l = n-1; l>=0;l--){
        for (ll r = l;r < n;r++){
            if(l == r) {

                dp[l][r] = v[l];

            }

            else {

                dp[l][r] = max(v[l] - dp[l+1][r], v[r] - dp[l][r-1]);

            }
        }
    }

    cout<<dp[0][n-1];
   
}   

Measured memory_bytes: 70016
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

int main() {
	int x, a, b; cin >> x >> a >> b;
	if (abs(a - x) > abs(b - x))cout << 'B' << endl;
	else cout << "A" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

#define mod 1000000007

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

int N,sum,ans=0;

int main(){
    cin>>N;
    int A[N];
    rep(i,N){
        cin>>A[i];
    }
    sort(A,A+N);
    rep(i,N-1){
        if(A[i]==A[i+1]){
            sum=2;
            i+=1;
            while(A[i]==A[i+1]){
                i++;
                sum++;
            }
            if(sum%2==1)ans++;
            sum=0;
        }
        else{
            if(i==N-2){
                ans+=2;
                break;
            }
            ans++;
        }
    }
    out(ans);
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M, C;
	int InputA;
	int S = 0;
	int B[20];
	int Ans = 0;

	cin >> N >> M >> C;
	
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}

	
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> InputA;
			S += InputA * B[j];
		}
		S += C;
		
		if (S > 0) {
			Ans++;
		}
		S = 0;
	}
	
	cout << Ans << endl;
}

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

using namespace std;

const int maxn = 100;

char c[maxn];

int main() {
    int n, ans = 0;
    cin >> n >> c;
    for (int i = 0; i < n; i++) {
        if (c[i] == 'A' && c[i + 1] == 'B' && c[i + 2] == 'C') {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int n;cin >> n;
    int a[n];
    rep(i,n)cin >> a[i];

    bool ans = true;
    for(int i=0;i<n;i++){
        if(a[i]%2==0){
            if(a[i]%3!=0 and a[i]%5!=0){
                ans =false;
            }
        }
    }

    if(ans) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;

    
    return 0;
}

Measured memory_bytes: 3624
n, m  = map(int, input().split())
vote_list = list(map(int, input().split()))
def choose(n, m, vote_list):
    votes = sum(vote_list)
    necessary = votes/(4*m)
    count = 0
    for item in vote_list:
        if item >= necessary:
            count += 1
    if count >= m:
        return "Yes"
    return "No"

print(choose(n, m, vote_list))

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

int main(void){
  int N, M; cin >> N >> M;
  vector<int> A(N, false);
  int ans = 0;
  for(int i = 0; i < M; i++){
    int v; cin >> v; 
    A[v-1] = true;
  }
  for(int i = 0;  i< M; i++){
    if(A[i] == false) ans++;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3136
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func scanInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = scanInt()
	}
	return sl
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	a := scanInts(n)

	sort.Ints(a)
	var w, h int
	for i := n - 1; i > 0; {
		if a[i] == a[i-1] {
			if w == 0 {
				w = a[i]
			} else if h == 0 {
				h = a[i]
				break
			}
			i -= 2
			continue
		}
		i--
	}
	if w != 0 && h != 0 {
		fmt.Println(w * h)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 4200
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1000000000000000000;

signed main(){
    int n;
    cin>>n;
    V<ll> a(n);
    cinf(n,a);
    V<ll> s(n+1,0);
    for(int i=0;i<n;i++) s[i+1]=s[i]+a[i];
    map<ll,ll> mp;
    for(int i=1;i<=n;i++) mp[s[i]]++;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(s[i]==0) ans++;
    }
    for(int i=1;i<=n;i++){
        if(mp.count(s[i])&&mp[s[i]]>0){
            ans+=mp[s[i]]-1;
            mp[s[i]]--;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 15872
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>

const int mod = 1000000007;

int main() {
	int N;
	scanf("%d", &N);
	int *B = new int[N - 1];
	for (int i = 0; i < N - 1; i++)scanf("%d", B + i);
	int res = B[0];
	for (int i = 1; i < N - 1; i++) {
		res += B[i] < B[i - 1] ? B[i] : B[i - 1];
	}
	res += B[N - 2];
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
//#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb emplace_back
#define mp make_pair
#define MOD (int) 1e9+7
#define for0(i, n) for (int i = 0; i < n; i++)
#define ff first
#define ss second
#define endl "\n"
#define bits(n) __builtin_popcount(n)
#define ini(a, i) memset(a, i, sizeof(a))

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	// cin >> t;
	t  = 1;
	while (t--)
	{
		ll n;
		cin >> n;
		ll a = 0, b = 0, c = 0, d = 0, e = 0;
		for (ll i = 0; i < n; i++)
		{
			string s;
			cin >> s;
			if (s == "AC")
				a++;
			else if (s == "TLE")
				b++;
			else if (s == "WA")
				c++;
			else if (s == "RE")
				d++;
		}
		cout << "AC x " << a << endl << "WA x " << c << endl;
		cout << "TLE x " << b << endl << "RE x " << d << endl;
	}
	return 0;
}


Measured memory_bytes: 3680
import java.util.Scanner;

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

    	Scanner scanner=new Scanner(System.in);

    	String input=scanner.next();

    	int first =input.indexOf("A");
    	int last=input.lastIndexOf("Z");


    	int result=last-first+1;
    	
    	System.out.println(result);

    	scanner.close();


    }

}

Measured memory_bytes: 26552
#include <stdio.h>

int main(void) 
{
    int a, b, d, r;
    double f;

    scanf("%d %d", &a, &b);

    d = a / b;
    r = a % b;
    f = (double)a / b;
    printf("%d %d %lf\n", d, r, f);

    return 0;

}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <iomanip>
#include <algorithm>

using namespace std;

#define ll long long
#define ld long double
#define fr(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) fr(i,0,n)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define sz(a) int((a).size())
#define srt(container, lambda) sort(container.begin(), container.end(), lambda)

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

int int_pow(int x, int p)
{
    if (p == 0) return 1;
    if (p == 1) return x;

    int tmp = int_pow(x, p/2);
    if (p%2 == 0) return tmp * tmp;
    else return x * tmp * tmp;
}

void fill(istream& in, vi& a, int n) {
    int elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(istream& in, vl& a, int n) {
    ll elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(vi& a, int n, int val) {
    rep(i, n) {
        a.push_back(val);
    }
}

void fill(vl& a, int n, ll val) {
    rep(i, n) {
        a.push_back(val);
    }
}

int sum(vi arr) {
    int s = 0;
    for (auto& x: arr)
        s += x;
    return s;
}

int min(vi a) {
    return *min_element(a.begin(), a.end());
}

void print(ostream& out, vi a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

void print(ostream& out, vl a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

#pragma GCC optimize("Ofast")
static auto speedup = [](){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();



class BFrog2 {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n, k;
	    in >> n >> k;
	    vl hs;
	    hs.push_back(0);
	    fill(in, hs, n);
	    ll mx = (1LL << 40);
	    vl dp(n+1, 0);
	    fr(i, 2, n + 1) {
	        ll mn = mx;
	        int minIndex = max(1, i - k);
	        fr(j, minIndex, i) {
                ll val = dp[j] + abs(hs[i] - hs[j]);
	            if (val < mn) {
                    mn = val;
                }
	        }
	        dp[i] = mn;
	    }
	    out << dp[n] << endl;
	}
};


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


Measured memory_bytes: 4576
import sys
N=int(input())
a=[int(i) for i in input().split()]
a.sort()

if a[N-1]-a[0]>1:
  print("No")
  sys.exit()
if a[0]==N-1:
  print("Yes")
  sys.exit()
if a[N-1]==1:
  print("Yes")
  sys.exit()
if a[0]==a[N-1]:
  if 2*a[0]<=N:
    print("Yes")
  else:
    print("No")
  sys.exit()

count=a.index(a[N-1])
if count+1<=a[N-1] and a[N-1]<=count+int((N-count)/2):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 13964