akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a)      cout<<a<<" "
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll minize(ll& a,ll b){return a=(a>b?b:a);}
inline ll maxize(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5],dp[3][MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c=0,sum=0,v,t;
	// PROCESS IN HERE
	string s;
	sc(s);
	s="@"+s;
	fu(i,1,le(s)-1){
		if(s[i]=='0'){
			dp[0][i]=dp[1][i-1];
			dp[1][i]=dp[0][i-1]+1;
		}
		else{
			dp[1][i]=dp[0][i-1];
			dp[0][i]=dp[1][i-1]+1;
		}
	}
	pr(min(dp[0][le(s)-1],dp[1][le(s)-1]));

	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

Measured memory_bytes: 5228
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;
int n;
bool check(int k){
    int N=n;
    int prev=0;
    while(prev!=N){
        prev=N;
        if(N%k==0){
            N=N/k;
        }
        else if(N>k){
            N=N-k;
        }
    }
    return N==1;
}

int32_t main(){
    ios::sync_with_stdio(false);
    
    cin>>n;
    set<int>ans;
    ans.insert(n);
    ans.insert(n-1);
    if(n==2){
        cout<<1<<"\n";
        return 0;
    }
    for(int i=2;i*i<=n;i++){
        // if(n%i==0){

            int N=n;
            while(N%i==0){
                N=N/i;
            }
            if(i==3){
                // deb(N);
            }
            if(N%i==1){
                ans.insert(i);
            }
        // }
    }
    n--;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            ans.insert(i);
            ans.insert(n/i);
        }
    }
    // deb(ans);
    cout<<ans.size()<<"\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, t=0;
  cin >> N;
  vector<int> A(N);
  REP(i,N) cin >> A[i];
  int no_1=0, no_2=0;
  REP(i,N) {
    if(A[i]>no_1) {
      no_1=A[i];
      t=i;
    }
    else {
      if(no_2<A[i]) no_2=A[i];
    }
  }
  REP(i,N) {
    if(i!=t) cout << no_1 << endl;
    else  cout << no_2 << endl;
  }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
      string S;
	  cin >> S;
  
  	  int start, end; 
  	  bool can =true;
  
  	  for(int i=0;i<S.size();i++){
        if(S[i] == 'A' && can){
          start = i;
          can = false;
        }
        if(S[i] == 'Z')
          end = i;
      }
  cout << end - start + 1<<endl;
}

Measured memory_bytes: 640
#include<cstdio>
const int N=1e5+10,p=1e9+7;
int n,cnt[N];
int power(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=1ll*x*x%p)
		if (y&1) ans=1ll*ans*x%p;
	return ans;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		cnt[x]++;
	}
	if (n&1){
		if (cnt[0]!=1) return puts("0"),0;
		for (int i=2;i<=n;i+=2)
			if (cnt[i]!=2) return puts("0"),0;
	}
	else{
		for (int i=1;i<=n;i+=2)
			if (cnt[i]!=2) return puts("0"),0;
	}
	printf("%d\n",power(2,n>>1));
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#define N 500001
#define SENTINEL 1000000005

int n,S[N]; // int ha 32bit system no tame 2*10no9jyou gurai
int cnt = 0;

// merge ha touchi. tumari ketugou.

void merge(int left, int mid, int right){

  int n1 = mid - left;
  int n2 = right - mid;

  // banpei you ni 1tu yobun ni kakuho
  int L[n1+1],R[n2+1];

  int i,j,k;

  // hairetsu wo 2tu ni wakeru
for (i = 0; i < n1; i++) L[i] = S[left + i];
  for ( i = 0; i < n2; i++) R[i] = S[mid + i];

  // hairetsu no saigo ni banpei wo setti
  L[n1] = R[n2] = SENTINEL;

  i = j = 0;

  for (k = left; k< right; k++)
    {
      cnt++;
      if(L[i] <= R[j]) S[k] = L[i++];// i++ ha i wo hyouka sitaato i wo 1 tuika suru.
      else S[k] = R[j++];  
    }
}



// mergeSort de bunkatsu
void mergeSort(int left,int right)
{
int mid;

  // hairetsu no nagasa ga 1 ika nara sort zumi
  if(right - left <=1) return;

  // hairetsu wo left~mid to mid~right no 2tu ni wakete sort
  mid = (left + right) /2;
  mergeSort(left, mid);
  mergeSort(mid,right);

  // hairetsu wo merge. tumari touchi
  merge(left, mid, right);

}

int main(void){
  int i;
  int left, right;
  scanf("%d", &n);
    for(i = 0; i<n; i++) scanf("%d",&S[i]);
  left = 0;
  right = n;
  mergeSort(left,right);// mergeSort de bunkatsu. merge de touchi.

  for (i = 0; i < n-1; i++)printf("%d ",S[i]);
  printf("%d\n",S[n-1]);
  printf("%d\n",cnt);
return 0;
}

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

int main(){
    int n;
    cin >> n;
    cout << setprecision(6) << fixed;
    if(n%2 == 0){
        cout << (double)0.5;
    }else{
        cout << double(n/2+1)/n;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
	int time[3][2][3];

	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 2; j++){
			for(int k = 0; k < 3; k++)
				cin >> time[i][j][k];
		}
	}

	for(int i = 0; i < 3; i++){
		int d[3] = {};
		for(int j = 2; j >= 0; j--){
			d[j] += time[i][1][j] - time[i][0][j];
			if(d[j] < 0){
				d[j] += 60;
				d[j-1]--;
			}

		}

		cout << d[0] << ' ' << d[1] << ' ' << d[2] << endl;
	}


	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
using namespace std;
int main() {
	string s;
	getline(cin, s);

	for (int i = 0; i < s.length(); i++) {
		if (islower(s[i])) {
			s[i] = toupper(s[i]);
		}
		else if (isupper(s[i])) {
			s[i] = tolower(s[i]);
		}
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3156
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
console.log(input[0].split(' ').map(Number).reduce(function(a, b) {
  if (a == b) {
    return 'a == b';
  } else if (a < b) {
    return 'a < b';
  } else {
    return 'a > b';
  }
}));

Measured memory_bytes: 15616
#include<stdio.h>
int main()
{
    int N,i,sum=0;
    char a[105],b[105],c[105];
    scanf("%d",&N);
    getchar();
    scanf("%s",a);
    getchar();
    scanf("%s",b);
    getchar();
    scanf("%s",c);
    for(i=0;i<N;i++)
        {
            if(a[i]==b[i]&&a[i]==c[i])
                continue;
            else if(a[i]==b[i]||a[i]==c[i]||b[i]==c[i])
                sum++;
            else
                sum+=2;
        }
    printf("%d",sum);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 55556;
int prime[MAX_N];
bool is_prime[MAX_N + 1];

int main(){
  int N;
  cin >> N;
  vector<int> vec;
  int p = 0;
  for(int i = 0; i <= MAX_N; i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for(int i = 2; i <= MAX_N; i++){
    if(is_prime[i]){
      if(i % 10 == 1) vec.push_back(i);
      prime[p++] = i;
      for(int j = 2*i; j <= MAX_N; j+= i) is_prime[j] =  false;
    }
  }
  for(int i = 0; i < N; i++){
    cout << vec[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main()
{
    int S, h, m, s;
    scanf("%d", &S);
    h = S / 3600;
    m = S % 3600 / 60;
    s = S % 60;
    printf("%d:%d:%d\n", h, m, s);
    return 0;
}



Measured memory_bytes: 2040
#include <stdio.h>

int main(void) {
  char inbuf[1280];
  int pos = 0;

  /* 情報数読取り */
  fgets(inbuf, sizeof(inbuf), stdin);

  /* 大文字と小文字の置換 */
  while (inbuf[pos] != EOF) {
    char theChar = inbuf[pos];
    if ((theChar >= 'a') && (theChar <= 'z'))
      inbuf[pos] = theChar - 32;
    else if ((theChar >= 'A') && (theChar <= 'Z'))
      inbuf[pos] = theChar + 32;
    pos++;
  }

  inbuf[pos] = 0;
  printf("%s", inbuf);

  return 0;
}

Measured memory_bytes: 524
def factorial(a):
    r = 1
    for i in range(a):
        r *= i+1
    return r

def combinations(a, b):
    if a>=0 and b>=0 and a >= b:
        return pow(9, b) * factorial(a) // factorial(b) // factorial(a-b)
    else:
        return 0

def count(m, a, b):
    # return the count of numbers in range [0, m x 10^a] with b non zero digitals
    ## the count of numbers in range [0, m x 10^a) with b non zero digitals
    r = combinations(a-1, b) + (m-1) * combinations(a-1, b-1)
    if b == 1:
        ## m x 10^a
        r += 1
    return r

def COUNT(N,K):
    digit = list(map(int, str(N)))
    M = len(digit)
    C = count(digit[0], M, K)
    N_ = N % pow(10, M-1)
    return C, N_
    

N = int(input())
K = int(input())

C = 0
while (N>0) and (K>0):
    c, N = COUNT(N, K)
    C+= c
    K-= 1

print(C)    


Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var x int
	fmt.Scan(&x)
	if x >= 400 && x < 600 {
		fmt.Println(8)
	} else if x >= 600 && x < 800 {
		fmt.Println(7)
	} else if x >= 800 && x < 1000 {
		fmt.Println(6)
	} else if x >= 1000 && x < 1200 {
		fmt.Println(5)
	} else if x >= 1200 && x < 1400 {
		fmt.Println(4)
	} else if x >= 1400 && x < 1600 {
		fmt.Println(3)
	} else if x >= 1600 && x < 1800 {
		fmt.Println(2)
	} else if x >= 1800 && x < 2000 {
		fmt.Println(1)
	}
}


Measured memory_bytes: 1832
#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <climits>

#include <cfloat>

#include <map>

#include <utility>

#include <set>

#include <iostream>

#include <memory>

#include <string>

#include <vector>

#include <algorithm>

#include <functional>

#include <sstream>

#include <complex>

#include <stack>

#include <queue>

#include <numeric>

#include <cstring>



#define rep(i, n) for(int i = 0; i < (n); i++)

#define pb push_back



using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef vector<int> vi;

typedef vector<vi> vvi;



const int INF = 1 << 29;

const double EPS = 1e-9;

const int MAX_N = 1000;



int main(){

	int n, ans;

	vector<string> field;

	vvi memo;



	while(1){

		ans = 0;

		cin >> n;

		if(n == 0) break;



		field.resize(n);

		memo.resize(n+2);



		rep(i, n) cin >> field[i];

		rep(i, n+2){

			memo[i].resize(n+2);

			fill(memo[i].begin(), memo[i].end(), 0);

		}



		rep(i,n){

			rep(j, n){

				if(field[i][j] == '.'){

					memo[i+1][j+1] = min(memo[i+1][j], min(memo[i][j+1], memo[i][j])) + 1;

				}

				ans = max(ans, memo[i+1][j+1]);

			}

		}

		cout << ans << endl;

	}

}

Measured memory_bytes: 4148
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {

	int n;
	scanf("%d", &n);


	printf("ABC%d", n);



}

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

using namespace std;

const long long INF = 1e18;

struct dat {
    int w, s, v;
    bool operator < (const dat& T) const {
        return s - T.w < T.s - w;
    }
}a[1005];

long long dp[10005];

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

    for (int i = 0; i < n; i++) {
        scanf("%d%d%d", &a[i].w, &a[i].s, &a[i].v);
    }

    sort(a, a + n);

    for (int i = 1; i <= 10000; i++) dp[i] = -INF;
    dp[0] = 0;

    long long res = 0;

    for (int i = 0; i < n; i++) {
        for (int j = a[i].s; j >= 0; j--) {
            res = max(res, dp[j] + a[i].v);
            if (j + a[i].w <= 10000) dp[j + a[i].w] = max(dp[j + a[i].w], dp[j] + a[i].v);
        }
    }

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


Measured memory_bytes: 384
import sys
from collections import deque

n=int(input())
edge=[[] for i in range(n+1)]

color=[-1]*(n+1)

for i in range(n-1):
    u,v,w=list(map(int,sys.stdin.readline().strip().split()))
    w%=2

    edge[u].append([v,w])
    edge[v].append([u,w])

q=deque([1])
color[1]=0

while len(q)>0:
    parent=q.popleft()
    pw=color[parent]

    for child,ew in edge[parent]:
        if color[child]!=-1:
            continue
        cw=(pw+ew)%2
        color[child]=cw
        q.append(child)

for i in range(1,n+1):
    print(color[i])



Measured memory_bytes: 79392
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,b,n) for(int i=b;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
const int mod=1e9+7;

ll k(int n){
    ll nn=1;
    for(int i=1;i<=n;i++)nn=nn*i%mod;
    return nn;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin>>n>>m;
    if(abs(n-m)>1){
        cout<<0<<endl;
        return 0;
    }
    if(n<m)swap(n,m);
    if(n==m)cout<<2*k(n)*k(m)%mod<<endl;
    else cout<<k(n)*k(m)%mod<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from sys import stdin, stdout
import math
from copy import deepcopy
rem=10**9+7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

a,b,c,x,y=take()
ans=10**12
d=max(x,y)*2
new=[]
while(d>=0):
    i=d/2
    j=d/2
    if i>=x:
        one=0
    else:
        one=(x-i)*a
    if j>=y:
        two=0
    else:
        two=(y-i)*b
    new.append(one+two+d*c)
    d-=1
print min(new)




Measured memory_bytes: 9084
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int i = 1;


		while(i <= n){
			int x = i;

			if(x % 3 == 0){
				System.out.print(" " + i);
			}else{
				if(x % 10 == 3){
					System.out.print(" " + i);
				}else{
					int y = x;
					while(y > 10){
						y /= 10;
						if(y % 10 == 3){
							System.out.print(" " + i);
							break;
						}
					}

				}
			}

			i++;
		}
		System.out.println();

	}

}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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



void func(long long A, long long B){

    cout<<A*B<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    func(A, B);
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;




void solve(){
    int h, n, sum = 0;
    cin>>h>>n;
    int a[n+3];
    f(i,n)cin>>a[i],sum += a[i];
    if(sum >= h)cout<<"Yes";
    else cout<<"No";
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
 int a,b,sum=0;
 scanf("%d",&a);
 scanf("%d",&b);

 if(a>=b){sum+=a;a--;}
 else {sum+=b;b--;}
  
  if(a>=b)sum+=a;
  else sum+=b;
  
  printf("%d",sum);
  
 return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {
	
	int x, y;
	cin >> x >> y;
	rep(i, x + 1) {
		int t = i, k = x - i;
		if (t * 2 + k * 4 == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

long long mod = 2019;
long long a, b, l = 2019;

int main() {
	cin >> a >> b;
	for (long long i = a; i <= b; ++i)
		for (long long j = i + 1; j <= b; ++j) {
			l = min(l, i * j % mod);
			if (l == 0) {
				cout << 0 << endl;
				return 0;
			}
		}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 256
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;
typedef pair < ll, int > PLI;


#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

#define fname ""

const ll ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const ld eps = 1e-7;
const int N = 2e3 + 6;

int n, m, A, B;
bool a[N][N];

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

    #ifdef krauch
        freopen("input.txt", "r", stdin);
    #else
        //freopen(fname".in", "r", stdin);
        //freopen(fname".out", "w", stdout);
    #endif

    cin >> n >> m >> A >> B;
    forn(i, 1, B) {
        forn(j, 1, A) {
            a[i][j] = 1;
        }
    }

    forn(i, B + 1, n) {
        forn(j, A + 1, m) {
            a[i][j] = 1;
        }
    }

    forn(i, 1, n) {
        forn(j, 1, m) {
            cout << a[i][j];
        }
        cout << "\n";
    }

    return 0;
}


Measured memory_bytes: 3200
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "OK" << endl ; else cout << "NG" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,m ;
	cin >> n >> m ;
	if(n&1){
		for(int i=1;i<=m;i++){
			cout << i << " " << n-i << endl ;
		}
	}else{
		for(int i=1;i<=m;i++){
			if(i&1){
				ll r = (m+1)/2-i/2 ;
				cout << r << " " << r+i << endl ;
			}else{
				ll r = m/2-(i-1)/2+(m+1)/2*2 ;
				cout << r << " " << r+i << endl ;
			}
		}
	}
}


Measured memory_bytes: 3644
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int A,B,C,K,ans=0;

int main() {
	cin>>A>>B>>C>>K;
	if(A>=K)ans=K;
	else if(A+B>=K)ans=A;
	else ans=A-(K-A-B);
	cout<<ans<<endl;
	return 0;
}



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

int main() {
  int n;
  cin >> n;
  int fn = 0;
  int m = n;
  while (m > 0) {
    fn += m%10;
    m /= 10;
  }

  if (n % fn == 0) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 256
from collections import defaultdict
N = int(input())
d = defaultdict(int)
for i in range(1, int(N**0.5)+1):
    for j in range(1, int(N**0.5)+1):
        for k in range(1, int(N**0.5)+1):
            t = i**2 + j**2 + k**2 + i*j + j*k + k*i
            d[t] += 1
for i in range(1, N+1):
    print(d[i])

Measured memory_bytes: 79364
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(void){
    int N,t=1;
    cin>>N;
    while(N>t){
        t*=2;
    }
    if(t>N)t/=2;
    cout<<t<<endl;
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

void fix(vector<P> &num) {
  if(SZ(num) < 2) return;
  if(num[SZ(num)-1].first == num[SZ(num)-2].first) {
    num[SZ(num)-2].second += num[SZ(num)-1].second;
    num.pop_back();
  }
  return;
}

void incr(vector<P> &num) {
  if(num.back().second == 1) {
    num.back().first += 1;
  } else {
    num.back().second--;
    num.push_back(P(num.back().first + 1, 1));
  }
  fix(num);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

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

  int l = 0, r = n+1;
  while(r - l > 1) {
    int mid = (l + r) / 2;
    vector<P> num;
    num.push_back({0, a[0]});
    bool ok = true;
    for(int i=1;i<n;++i) {
      if(a[i-1] < a[i]) {
        num.push_back({0, a[i] - a[i-1]});
      } else {
        int su = 0;
        while(SZ(num) > 0 && su + num.back().second <= a[i-1] - a[i]) {
          su += num.back().second;
          num.pop_back();
        }
        num.back().second -= a[i-1] - a[i] - su;

        if(num.back().first == mid-1) {
          if(SZ(num) == 1) {
            ok = false;
            break;
          }
          int val = num.back().second;
          num.pop_back();
          incr(num);
          num.push_back({0, val});
        } else {
          incr(num);
        }
      }
      fix(num);
    }

    if(ok) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r << endl;

}


Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(a == b) cout << c << endl;
  else if(a == c) cout << b << endl;
  else cout << a << endl;
}

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

int main(){
    ll n,m;
    cin>>n>>m;
    ll cnt=0;
    if(m>=n*2){
        cnt+=n;
        m-=n*2;
        m/=4;
        cnt+=m;
    }
    else cnt+=m/2;
    cout<<cnt<<endl;

}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc146/tasks/abc146_d

#include "algorithm"
#include "cmath"
#include "functional"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; 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 fi first
#define se second
using namespace std;
typedef long long ll;
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;

ll color_ct = 0;

void dfs(ll u, ll p, ll color_p, V<VPL>& edge_list, VL& colors) {
  ll next_color = 1;

  for (auto e : edge_list[u]) {
    ll v = e.fi;
    if (v == p) {
      continue;
    }

    if (next_color == color_p) next_color++;
    colors[e.se] = next_color;
    chmax(color_ct, next_color);

    dfs(v, u, next_color, edge_list, colors);
    next_color++;
  }
}

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

  V<VPL> edge_list(N, VPL(0));

  VL colors(N - 1);

  rep(i, N - 1) {
    ll a, b;
    cin >> a >> b;
    a--, b--;

    edge_list[a].emplace_back(b, i);
    edge_list[b].emplace_back(a, i);
  }

  dfs(0, -1, -1, edge_list, colors);

  cout << color_ct << endl;
  rep(i, N - 1) { cout << colors[i] << 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: 10752
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
/*
0<=X<=K, 0<=Y<=Kで、X+Y = Sとなる通りの数…
S<0, S>2Kなら0。
0<=S<=Kなら、S+1。
K<=S<=2Kなら、(2K-S)+1。
*/

int f(int K,int S) {
	if (0 <= S && S <= K) { return S + 1; }
	if (K < S && S <= 2 * K) { return 2 * K - S + 1; }
	return 0;
}

int main() {
	int K, S, i, ans;
	ans = 0;
	scanf("%d %d", &K, &S);

	for (i = 0; i <=K; i++) {
		ans = ans + f(K, S - i);
	}

	printf("%d", ans);
}


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

using namespace std;

const long long INF = 1LL << 60;

long long dp[100010];


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

int main() {
    // でかい値で初期化
    //for (long long & i : dp)
    //    i = INF;

    // 初期条件
    dp[0] = 0;

    int n, k;
    cin >> n >> k;

    int h[n];
    for (int i=0; i<n; i++)
        cin >> h[i];

    for (int i=1; i<n; i++) {
        dp[i] = INF;
        for (int j = 0; j<k; j++) {
            if (j+1 > i)
                break;

            chmin(dp[i], dp[i-j-1] + abs(h[i] - h[i-j-1]));
        }
    }

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


Measured memory_bytes: 1408
//Deep Godhani
//DAIICT

#include<bits/stdc++.h>
using namespace std;

#define N 100000000000
#define PI acos(-1)
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define ll long long int
#define ld long double
#define precision(x,d) cout << fixed << setprecision(d) << x
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))

bool compare(pair<int,int> a, pair<int,int> b)
{
  int m1 = min(a.first,b.first);
  int m2 = min(a.second,b.second);

  if(m1 < m2)
  {
    if(a.first < b.first)
    {
      return true;
    }
    else if(a.first == b.first)
    {
      if(a.second < b.second)
      {
        return true;
      }
      else
      {
        return false;
      }
    }
    else
    {
        return false;
    }
  }
  else
  {
    if(a.second < b.second)
    {
      return true;
    }
    else if(a.second == b.second)
    {
      if(a.first < b.first)
      {
        return true;
      }
      else
      {
        return false;
      }
    }
    else
    {
      return false;
    }
  }
}

void solve()
{
  string s;
  cin >> s;

  ll ans = 0;
  for(int i=0;i<s.length();i++)
  {
    ans += (s[i] - '0');
    ans = ans%9;
  }

  if(ans == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

int main()
{
    FAST;
    ll t=1;
    //cin >> t;
    while(t--)
    {
			solve();
    }
		return 0;
}


Measured memory_bytes: 3732
/*
在太阳西斜的这个世界里
置身天上之森。
等这场战争结束之后
不归之人与望眼欲穿的众人
人人本着正义之名
长存不灭的过去
逐渐消逝的未来
我回来了
纵使日薄西山
即便看不到未来
此时此刻的光辉
盼君勿忘
*/

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
    int x;
    cin>>x;
    cout<<1-x;
	return 0;
}

Measured memory_bytes: 3592
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
			solve();
	}

	public static void solve() { 
		
		long a = sc.nextInt();
		long b = sc.nextInt();
		long c = sc.nextInt();
		long d = sc.nextInt();
		long max = Long.MIN_VALUE;
		long n1 = a * c;
		long n2 = a * d;
		long n3 = b * c;
		long n4 = b * d;
		max = Math.max(max, Math.max(n1, Math.max(n2, Math.max(n3, n4))));
		System.out.println(max);
	}
}

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

int main(){
	int A,B,C;
  	cin >> A >> B >> C;
  
  	if(A == 5 && B == 5 && C == 7){
    	cout << "YES" << endl;
    }else if(A == 5 && B == 7 && C == 5){
    	cout << "YES" << endl;
    }else if(A == 7 && B == 5 && C == 5){
    	cout << "YES" << endl;
    }else{
    	cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
using namespace std;

const long long int mod=998244353;
const long long int INF=99999999999999999;
long long int d2[1000][1000];
long long int N,M,L,A[100000],B[100000],C[100000],Q,s[100000],t[100000],d[1000][1000];
string str;

void dijkstra() {
	for (int k = 1; k <= N; k++) {
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

void dijkstra2() {
	for (int k = 1; k <= N; k++) {
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= N; j++) {
				d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
			}
		}
	}
}

int main() {
	cout << fixed << setprecision(10);
    cin>>N>>M>>L;
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            d[i][j]=INF;
            d2[i][j]=INF;
        }
    }
    for(int i=0;i<M;i++){
        cin>>A[i]>>B[i]>>C[i];
        d[A[i]][B[i]]=C[i];
        d[B[i]][A[i]]=C[i];
    }
    dijkstra();
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            if(d[i][j]<=L){d2[i][j]=1;}
        }
    }
    dijkstra2();

    cin>>Q;
    for(int i=0;i<Q;i++){
        cin>>s[i]>>t[i];
        if(d2[s[i]][t[i]]==INF){cout<<-1<<endl;}
        else{cout<<d2[s[i]][t[i]]-1<<endl;}
    }
    
} 


Measured memory_bytes: 12416
# エラトステネスの篩, フェルマーの小定理
def make_prime_table(N):
    sieve = list(range(N + 1))
    sieve[0] = -1
    sieve[1] = -1
    for i in range(2, int(N ** 0.5) + 1):
        if sieve[i] != i:
            continue
        for j in range(i * i, N + 1, i):
            if sieve[j] == j:
                sieve[j] = i
    return sieve


N = int(input())
A = list(map(int, input().split()))

m = 1000000007

prime_table = make_prime_table(1000000)

lcm_factors = {}
for i in range(N):
    t = []
    a = A[i]
    while a != 1:
        if len(t) != 0 and t[-1][0] == prime_table[a]:
            t[-1][1] += 1
        else:
            t.append([prime_table[a], 1])
        a //= prime_table[a]
    for k, v in t:
        if k not in lcm_factors or lcm_factors[k] < v:
            lcm_factors[k] = v

lcm = 1
for k in lcm_factors:
    for i in range(lcm_factors[k]):
        lcm *= k
        lcm %= m

result = 0
for i in range(N):
    result += lcm * pow(A[i], m - 2, m)
    result %= m
print(result)


Measured memory_bytes: 49856
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc171/tasks/abc171_c
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string ans = "";
    ll n;
    cin >> n;
    while(n){
        ll temp = (n-1)%26;
        ans += ('a' + temp);
        n = (n-1)/26;
    }
    reverse(all(ans));
    cout << ans;

	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>

int main(){
	int i,j;
	int n;
	char ans[77];
	char input[1025];
	char set[10][5]={"null",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
	int now,cnt;

	scanf("%d",&n);
	while(n--){
		j = 0;
		now = 0;
		cnt = -1;
		scanf("%s",input);
		for(i = 0;input[i] != '\0';i++){
			switch(input[i]){
				case '0':
					if(now){
						ans[j] = set[now][cnt];
						j++;
						cnt = -1;
						now = 0;
					}
					break;
				case '1':
					now = input[i] -'0';
					cnt++;
					cnt %= 5;
					break;
				case '7':
				case '9':
					now = input[i] -'0';
					cnt++;
					cnt %= 4;
					break;
				case '2':
				case '3':
				case '4':
				case '5':
				case '6':
				case '8':
					now = input[i] -'0';
					cnt++;
					cnt %= 3;
					break;
			}
		}
		ans[j] = '\0';
		printf("%s\n",ans);
	}
	return 0;
}

Measured memory_bytes: 588
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    ll x ;
    cin >> x ;
    if(x >= 0){
        rep(i, 1000){
            rep(j,1000){
                if(pow((double)i, 5) - pow((double)j, 5) == x){
                    cout << i << " " << j << endl ; 
                    return 0 ;
                }
            }
        }
        rep(i, 1000){
            rep(j, 1000){
                if(pow((double)i, 5) + pow((double)j, 5) == x){
                    cout << i << " " << -j << endl ;
                    return 0 ;
                }
            }
        }
    }
    else {
        rep(i, 1000){
            rep(j,1000){
                if(pow((double)i, 5) - pow((double)j, 5) == x){
                    cout << i << " " << j << endl ; 
                    return 0 ;
                }
            }
        }
        rep(i, 1000){
            rep(j, 1000){
                if(-(pow((double)i, 5) + pow((double)j, 5)) == x){
                    cout << -i << " " << j << endl ;
                    return 0 ;
                }
            }
        }
    }
}  

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


void solve(std::string S){
    int res = 0;
    for(int len=S.size(); len >= 0; len--){
        // i + lenは文字列の後ろの区切り。なので<=
        for(int i=0; i + len <= S.size(); i++){
            auto ss = S.substr(i, len);
            int as = count(ss.begin(), ss.end(), 'A');
            int cs = count(ss.begin(), ss.end(), 'C');
            int ts = count(ss.begin(), ss.end(), 'T');
            int gs = count(ss.begin(), ss.end(), 'G');
            if(as + cs + ts + gs == len){
                res = len;
                goto SKIP;
            }
        }
    }
    SKIP: 1+1;
    cout << res << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
import itertools

N, M = map(int, input().split())
k, s = [], []

for i in range(M):
    tmp = [int(j) for j in input().split()]
    k.append(tmp[0])
    s.append(tmp[1:])
p = [int(j) for j in input().split()]

ans = 0

for switch in itertools.product(range(2), repeat=N):
    flg = True
    for i in range(M):
        snum = 0
        for j in range(k[i]):
            if switch[s[i][j]-1]:
                snum += 1
        if snum % 2 == p[i]:
            continue
        else:
            flg = False
            break
    if flg:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n,m,s[15],d[100],dp[101][1<<15];

void Min(int &a,int b){a=min(a,b);}

int main(){
  int n,m;
  while(cin>>n>>m,n){
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<m;i++)cin>>d[i];
    sort(d,d+m);

    int sum[1<<15]={};
    for(int i=0;i<(1<<n);i++)
      for(int j=0;j<n;j++)
	if((1<<j)&i)sum[i]+=s[j];

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

    for(int i=0;i<m;i++)
      for(int j=0;j<(1<<n);j++){
	for(int k=0;k<n;k++)
	  if(((1<<k)&j)==0)Min(dp[i][j+(1<<k)],dp[i][j]);
	Min(dp[i+1][j],dp[i][j]+abs(sum[j]-d[i]));
      }
    int mn=1e9;
    for(int i=0;i<(1<<n);i++)Min(mn,dp[m][i]);
    cout<<mn<<endl;
  }
  return 0;
}

Measured memory_bytes: 16016
N = int(input())
a = list(map(int, input().split()))
count = 0
i = 0
while (True):
	if (a[i] % 2 == 0):
		a[i] /= 2
		count += 1
		continue
	i += 1
	if(i >= len(a)):
		break

print(count)

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

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

int main(void)
{
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  FOR(i, a+1) FOR(j, b+1) FOR(k, c+1)
  {
    if (i*500 + j*100 + k*50 == x)
    {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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 all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    cout << accumulate(a.begin(), a.begin() + k, 0) << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define fuck 2000000000
#define hell 2000000000000000000
#define ff first
#define ss second 
#define forn(i,n) for (int i=0;i<int(n);i++)
#define nfor(i,n) for (int i=int(n)-1;i>=0;i--)
#define N 100010
#define M 1000010
using namespace std;
const int MOD = 1000000007;
const double PI = acos(-1.0);
int gcd(int a,int b){return (b==0) ? a : gcd(b,a%b);}
int n;
int ar[N];
int ans=0;
int main(){
	
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&ar[i]);
	}
	for (int i=1;i<n;i++){
		if (ar[i]==i){
			ans++;
			swap(ar[i],ar[i+1]);
		}
	}
	if (ar[n]==n)
		ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
	char a, b;

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

	if(a=='H' && b=='H')
		printf("H");
	else if(a=='H' && b=='D')
		printf("D");
	else if(a=='D' && b=='H')
		printf("D");
	else if(a=='D' && b=='D')
		printf("H");

	printf("\n");

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
const int INF=0x3f3f3f3f,M=30;
const double PI=acos(-1.),EPS=1e-10;
typedef pair<int,int> P;
int n,m,ans;
int a[M][M],dis[M][M];
char s[M];
int bfs(int x,int y)
{
    memset(dis,-1,sizeof(dis));
    dis[x][y]=0;
    int re=0;
    int d[5][5]={{0,1},{0,-1},{-1,0},{1,0}};
    queue<P> q;
    q.push(P(x,y));
    while(!q.empty())
    {
        P u=q.front();q.pop();
        x=u.first,y=u.second;
        for(int i=0;i<4;i++)
        {
            int dx=x+d[i][0],dy=y+d[i][1];
            if(dx>=0 && dx<n &&
        dy>=0 && dy<m && dis[dx][dy]==-1 && a[dx][dy])
            {
                dis[dx][dy]=dis[x][y]+1;
                q.push(P(dx,dy));
            }
        }
    }
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            re=max(re,dis[i][j]);
   // for(int i=0;i<n;i++)
   //     for(int j=0;j<m;j++)
   //         printf("%d%c",dis[i][j],j==m-1?'\n':' ');
   // exit(0);
    return re;
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        scanf("%s",s);
        for(int j=0;j<m;j++)
            a[i][j]=(s[j]=='.');
    }
    for(int i=0;i<n;i++)
    for(int j=0;j<m;j++)
        if(a[i][j])
        ans=max(ans,bfs(i,j));
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<ctime>
#include<cstdlib>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-10;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=5e5+100;
struct node
{
    int l,r,id;
}Q[maxn];
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
int ans[maxn];
int answer[maxn];
int flag[maxn];
int a[maxn];
bool cmp(node x,node y)
{
    if(ans[x.l]==ans[y.l])
        return x.r<y.r;
    return ans[x.l]<ans[y.l];
}
int n,m,k;
int L = 1,R = 0;
int Ans= 0;
void add(int x)
{
    if(!flag[a[x]])Ans++;
	flag[a[x]]++;
}
void del(int x)
{
    flag[a[x]]--;
    if(!flag[a[x]])Ans--;
}
void solve(){
	int n=read(),m=read();
	int sz = sqrt(n);
    for(int i = 1; i <= n; i++){
        a[i]=read();
        ans[i] = i/sz;
    }
    for(int i = 1; i <= m; i++)
    {
        Q[i].l=read();
        Q[i].r=read();
        Q[i].id = i;
    }
    sort(Q+1,Q+m+1,cmp);
    for(int i = 1; i <= m; i++)
    {
        while(L<Q[i].l)
        {
            del(L);
            L++;
        }
        while(R>Q[i].r)
        {
            del(R);
            R--;
        }
        while(L>Q[i].l)
        {
            L--;
            add(L);
        }
        while(R<Q[i].r)
        {
            R++;
            add(R);
        }
        
        answer[Q[i].id] = Ans;
    }
    for(int i = 1; i <= m; i++)
    {
        printf("%d\n",answer[i]);
    }
}
int main(){
	//freopen("D://data.txt","r",stdin);
	//freopen("D://out.txt","w",stdout);
    solve();
    return 0;
}

Measured memory_bytes: 17416
s=input()
a=len(s)
for i in set(s):
    ss=s
    j=0
    while len(set(ss))>1:
        t=""
        for k in range(len(ss)-1):
            if i in (ss[k],ss[k+1]):
                t+=i
            else:
                t+=ss[k]
        ss=t
        j+=1
    a=min(a,j)
print(a)

Measured memory_bytes: 9036