akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())

judge = 0
for i in range(0,101):
    a1 = i

    b1 = c11 - a1
    b2 = c12 - a1
    b3 = c13 - a1
    
    if c21 - b1 == c22 - b2 and c22 - b2 == c23 -b3:
        if c31 - b1 == c32 - b2 and c32 - b2 == c33 -b3:
            print("Yes")
            judge = 1
            break
        else:
            pass
    else:
        pass

if judge == 0:
    print("No")
else:
    pass

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <functional>
#include <string>
#include <cstring>
#include <sstream>
#include <deque>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> Q;

const int inf1=2e9+9;
const ll inf2=8e18+9;
const ll mol=998244353;
const int maxn=1e5+9;
const ll maxx=1e12+9;

ll a,b,v,w,t;

int main()
{
    cin>>a>>v>>b>>w>>t;
    if(a==b||(v-w)*t>=max(a,b)-min(a,b)) cout<<"YES\n";
    else cout<<"NO\n";
}


Measured memory_bytes: 3136
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int n;string a,b;
	cin>>n>>a>>b;
	int ans=0;
	for(int i=0;i<n;i++){
		bool ok=true;
		for(int j=0;j+i<n;j++){
			if(a[i+j]!=b[j])ok=false;
		}
		if(ok)break;
		ans++;
	}
	cout<<ans+n<<endl;
	return 0;
}


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

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

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

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

int N;
VI G[100011];

void MAIN() {
    scanf("%d", &N);
    LL K = 0;
    while (K * (K-1) / 2 < N) K++;
    if (K * (K-1) / 2 == N) {
	puts("Yes");
	int cnt = 1;
	REP (i, K) REP (j, i) {
	    G[i].push_back(cnt);
	    G[j].push_back(cnt);
	    cnt++;
	}
	printf("%d\n", (int)K);
	REP (i, K) {
	    printf("%d ", (int)G[i].size());
	    rprintf("%d", G[i].begin(), G[i].end());
	}

    } else {
	puts("No");
    }


}

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



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

typedef long long int ll;

int main(){
  string S;
  cin >> S;
  int a,b,c,n;
  n = S.size();
  a = count(S.begin(),S.end(),'a');
  b = count(S.begin(),S.end(),'b');
  c = count(S.begin(),S.end(),'c');
  if(abs(a-b) > 1 || abs(a-c) > 1 || abs(b-c) > 1){
     cout << "NO" << endl;
  }else{
     cout << "YES" << endl;
  }
}

Measured memory_bytes: 512
#include <stdio.h>

int main(){
    int H, W, i, j, k;
    
    for(k=0; ; k++){
    scanf("%d%d", &H, &W);
    if (H==0 && W==0) break;
        
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
                if((i+j)%2==0)
                    printf("#");
                else
                    printf(".");
            }
        printf("\n");
        }
    printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int resolve(long long );
int resolve(long long n)
{
    int i,tmp,cnt=0;
    for(i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            tmp=i;
        }
    }
    tmp=n/tmp;
    while(tmp)
    {
        tmp=tmp/10;
        cnt++;
    }
    return cnt;
}
int main()
{
    long long n;
    scanf("%lld",&n);
    printf("%d\n",resolve(n));
    return 0;
}

Measured memory_bytes: 128
require "prime"

a, b = gets.split.map(&:to_i)

aa = Prime.prime_division(a)
bb = Prime.prime_division(b)

cnt = 0
aa.each do |x|
    bb.each do |y|
       cnt += 1 if x[0] == y[0] 
    end
end

puts cnt+1


Measured memory_bytes: 2300
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int bingo[][] = new int[3][3];
		int B[][] = new int[3][3];
		int count[] = new int [8];
		for(int i=0;i<3;i++) {
			for(int j =0; j<3;j++) {
				bingo[i][j] = sc.nextInt();
			}
		}
		int N = sc.nextInt();
		for(int i=0;i<N;i++) {
			int taget = sc.nextInt();
			for(int s=0;s<3;s++) {
				for(int j =0; j<3;j++) {
					if(taget==bingo[s][j]) {
						B[s][j] =1;
						if(s == 0)count[0]++;
						if(s == 1)count[1]++;
						if(s == 2)count[2]++;
						if(j == 0)count[3]++;
						if(j == 1)count[4]++;
						if(j == 2)count[5]++;
						if(s == j)count[6]++;
						if(s+j==2 )count[7]++;
						break;
						
						
					}
				}
			}
		}
		boolean s = false;
		for(int i=0;i<8;i++) {
			if(count[i] == 3) {
				s =true;
				break;
			}
		}
		if(s == true ) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		
		
	}
}


	

Measured memory_bytes: 21844
Imports System.Console
Module Module1
    Dim ans As Int64
    Dim max As Int64
    Dim n, k, x, t, d As Int64
    Sub Main()
        Dim ss() As String = ReadLine.Split
        Dim s As Integer
        d = ss(0)
        t = ss(1)
        s = ss(2)
        If s * t >= d Then
            WriteLine("Yes")
        Else
            WriteLine("No")
        End If
        ReadLine()
    End Sub
    Sub Add(ByRef arr() As Integer, ByVal num As Integer)
        If arr Is Nothing Then
            ReDim arr(0)
            arr(0) = num
        Else
            ReDim Preserve arr(arr.Length)
            arr(arr.Length - 1) = num
        End If
    End Sub
End Module


Measured memory_bytes: 28408
#include<bits/stdc++.h>
#include<atcoder/segtree>
#define REP(i,b,e) for(int i=b; i<e; i++)

int op(int a, int b){
	return std::max(a, b);
}

int e(){
	return 0;
}

int main(){
	int n, k;
	scanf("%d %d", &n, &k);
	atcoder::segtree<int, op, e> seg(300100);
	REP(i, 0, n){
		int a;
		scanf("%d", &a);
		int l = std::max(0, a-k);
		int r = std::min(300100, a+k+1);
		int cnt = seg.prod(l, r);
		if(cnt+1>seg.get(a)) seg.set(a, cnt+1);
	}
	printf("%d\n", seg.all_prod());
	return 0;
}



Measured memory_bytes: 8572
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>n;
    vector<ll> v(n);
    rep(i,n) cin>>v[i];
    a=*max_element(all(v));
    b=accumulate(all(v),0);
    if(b-a-a>0) Yes;
    else No;

    

    return 0;
}


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

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

  string ans;
  int64_t d= c-(a+b);
  if(d < 0){
    ans= "No";
  }
  else{
    ans= (4*a*b < d*d) ? "Yes" : "No";
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;
typedef pair<llong, llong> pll;

int main(){

  int n, m;
  cin >> n >> m;

  priority_queue<pll, vector<pll>, greater<pll>> que;
  REP(i,n){
    int a, b;
    cin >> a >> b;
    que.push(MP(a,b));
  }

  llong ans = 0;
  while(m > 0){
    pll tmp = que.top();
    que.pop();
    llong val = tmp.first, num = tmp.second;
    if(num > m){
      ans += val * m;
      m = 0;
    }else{
      ans += val * num;
      m -= num;
    }
  }

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



Measured memory_bytes: 2420
n, m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
all = sum(a)

bi = all/(4*m)
ans = 0
for i in a:
  if i >= bi:
    ans += 1

if ans >= m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
    int k, a, b, A, B, i, j;
    cin >> k>>a>>b;
    A = a/k;
    B = b/k;
    i = a%k;
    j = b%k;
    if(A<B || (a==b && i==0) || (a!=b && A==B && i==0))
        cout << "OK" << endl;
    else
        cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3636
using System;

class Program
{
    static void Main()
    {
        string[] array = Console.ReadLine().Split(' ');
        int N = int.Parse(array[0]);
        int M = int.Parse(array[1]);
        int X = int.Parse(array[2]);
        int Y = int.Parse(array[3]);

        array = Console.ReadLine().Split(' ');
        int[] x = new int[array.Length];
        for (int i = 0; i < N; i++)
            x[i] = int.Parse(array[i]);

        array = Console.ReadLine().Split(' ');
        int[] y = new int[array.Length];
        for (int i = 0; i < M; i++)
            y[i] = int.Parse(array[i]);

        bool flag = false;

        for (int i = X + 1; i <= Y; i++)
        {
            for (int j = 0; j < N; j++)
            {
                if (x[j] < i)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                    break;
                }
            }

            if (flag)
            {
                for (int j = 0; j < M; j++)
                {
                    if (y[j] >= i)
                    {
                        flag = true;
                    }
                    else
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (flag) break;
        }
        if (flag) Console.WriteLine("No War");
        else Console.WriteLine("War");
    }
}

Measured memory_bytes: 11092
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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; }



int main() {  
    int n, k; cin >> n >> k;
    int res = 1;
    rep(i, n){
        res = min(res*2, res+k);
    }
    cout << res << ln;
}




Measured memory_bytes: 256
function get_data_from_stdin()
	return Base.parse.( Base.split( Base.readline( Base.STDIN ) ) )
end

function abc082_a()

	# STEP.01
	# get the target positive numbers
	a, b = get_data_from_stdin()

	# STEP.02
	# output the result
	Base.println( Base.STDOUT, Base.div(a+b+1, 2) )

	# STEP.TRUE_END
	return Base.nothing

end

#==================================================================================================#

Main.abc082_a()


Measured memory_bytes: 174380
#include<iostream>
using namespace std;
int main(){
	while(1){
		int n = 0;
		cin >> n;
		if(n == 0) break;
		int maxNum = -1, maxP;
		for(int i = 0;i < n;i++){
			int p, d1, d2;
			cin >> p >> d1 >> d2;
			if(maxNum < d1 + d2){
				maxNum = d1 + d2;
				maxP = p;
			}
		}
		cout << maxP << ' ' << maxNum << endl;
	}
	return 0;
}

Measured memory_bytes: 864
n = int(input())
arr  = list(map(int , input().split()))
cnt =[-1]*(n+1)
mod = 10**9+7
fact=[1]
now =1
for i in range(1, n+2):
	now =(now%mod)*(i%mod)
	now = now%mod
	fact.append(now)
inverse = []
for i in range(n+2):
	inverse.append(pow(fact[i] , mod-2, mod))
l  , r, =0 , 0
for i in range(0, n+1):
	if cnt[arr[i]]!=-1:
		l = cnt[arr[i]]
		r= i
		break
	cnt[arr[i]]=i

for i in range(1, n+2):
	ans = (fact[n+1]*inverse[i]*inverse[n+1-i])%mod
	rem = n-r+l
	if rem>=i-1:
		ans = ans-(fact[rem]*inverse[i-1]*inverse[rem-(i-1)])%mod+mod
		ans = ans%mod
	print(ans)

Measured memory_bytes: 97080
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int lcnt = 0, rcnt = 0;
    for(int i = 0; i < N; i++) {
        if(S[i] == '(') {
            rcnt++;
        } else {
            if(rcnt > 0) {
                rcnt--;
            } else {
                lcnt++;
            }
        }
    }
    rep(i, lcnt) { S = '(' + S; }
    rep(i, rcnt) { S = S + ')'; }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 1e5+7;
LL a[MAXN], b[MAXN];

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

    int n;
    cin >> n;

    for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];

    LL ans = 0;
    for (int i = n; i > 0; i--) {
        a[i] += ans;
        LL z = (a[i]+b[i]-1)/b[i];
        ans += z*b[i]-a[i];
    }

    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 1792
#include<iostream>

using namespace std;

int main()
{
	char temp;
	int n, num;
	int arr[4][14] = {0};

	cin >> n;
	for (int i = 0; i != n; ++i)
	{
		cin >> temp >> num;
		switch (temp)
		{
		case 'S':arr[0][num] = 1; break;
		case 'H':arr[1][num] = 1; break;
		case 'C':arr[2][num] = 1; break;
		case 'D':arr[3][num] = 1; break;
		}
	}

	for (int i = 0; i != 4; ++i)
	{
		for (int j = 1; j != 14; ++j)
		{
			if (!arr[i][j])
			{
				switch (i)
				{
				case 0:cout << "S "; break;
				case 1:cout << "H "; break;
				case 2:cout << "C "; break;
				case 3:cout << "D "; break;
				}
				cout << j<<endl;
			}
		}
	}
	
	return 0;

}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include<algorithm>
#include <set>
#include <stdlib.h>

using namespace std;

int main()
{
    map<int,int>m;
    int n,r;
    cin>>n;
    for(int j=1;j<=100;j++)
    {
        for(int k=1;k<=100;k++)
        {
            for(int h=1;h<=100;h++)
            {
                r=(j*j)+(k*k)+(h*h)+(j*k)+(k*h)+(j*h);
                m[r]++;
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        cout<<m[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 5444
#include <cstdio>

using namespace std ;
typedef int Read ; // Here to change reading type
inline Read Readin() {
	register Read K = 0 , F = 1 ; register char C = getchar() ;
	while( C < '0' or C > '9' ) F = C == '-' ? -1 : 1 , C = getchar() ;
	while( C >= '0' and C <= '9' ) K = ( K << 3 ) + ( K << 1 ) + C - '0' , C = getchar() ;
	return F * K ;
}
inline Read Min( Read A , Read B ) { return A < B ? A : B ; }
inline Read Max( Read A , Read B ) { return A > B ? A : B ; }
inline Read Abs( Read A ) { return A < 0 ? -A : A ; }
#define I(X) freopen(#X".in","r",stdin)
#define O(X) freopen(#X".out","w",stdout)
#define CLO fclose(stdin),fclose(stdout)
int main() {
	long long N , X , Ans ;
	scanf( "%lld%lld" , &N , &X ) ;
	Ans = N ;
	N = N - X ;
	while( 1 ) {
		Ans += ( N / X ) * X << 1 ;
		if( N % X ) {
			long long T = X ;
			X = N % X ;
			N = T ;
		}
		else {
			Ans -= X ;
			break ;
		}
	}
	printf( "%lld\n" , Ans ) ;
	return 0 ;
}


Measured memory_bytes: 760
'use strict'
let input = require("fs").readFileSync("/dev/stdin", "utf8");
let N = input.split(' ')[0]*1;
let A = input.split(' ')[1]*1;
let B = input.split(' ')[2]*1;
let dist = Math.abs(A - B)%2;
let ans = dist == 0? "Alice" : "Borys";
console.log(ans);


Measured memory_bytes: 7372
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        _out.println((b - a == c - b ? "YES" : "NO"));
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 23764
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	int a[10][10]={},x,y,size,dumy=0,max=0,ans=0;
	int mx[13]={0,0,-1,1,0,-1,1,-1,1,0,-2,2,0},my[13]={0,-1,0,0,1,-1,-1,1,1,-2,0,0,2};
	while(scanf("%d,%d,%d",&x,&y,&size)!=EOF){
		dumy=4*size+1;
		//cout<<size<<endl;
		for(int i=0;i<dumy;i++){
			if(x+mx[i]>=0&&y+my[i]>=0&&x+mx[i]<10&&y+my[i]<10)
			a[x+mx[i]][y+my[i]]++;
		}
	}
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(a[i][j]==0){
				ans++;
			}else{
				if(max<=a[i][j])
				max=a[i][j];
			}
		}
	}
	cout<<ans<<endl<<max<<endl;
return 0;
}

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

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (a-b >= 0) cout << "delicious" << endl;
  if (a-b+x < 0) cout << "dangerous" << endl;
  else if (a-b < 0) cout << "safe" << endl;
}

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

int main(){
  int n,u,k,v;
  int i,j;
  int A[MAX][MAX];
  cin >> n;
  for(i = 0; i < n; i++){
    for(j = 0; j< n; j++){
      A[i][j] = 0;
    }
  }
  for(i = 0; i < n; i++){
    cin >> u;
    cin >> k;
    u = u-1;
    for(j = 0; j < k; j++){
      cin >> v;
      v = v-1;
      A[u][v] = 1;
    }
  }
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      if(0 < j){
        cout << " ";
      }
      cout << A[i][j];
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 3088
import string
import sys

str = ''
for s in sys.stdin:
    str += s

dict = {e: 0 for e in string.ascii_lowercase}

for e in str:
    if e.lower() in string.ascii_lowercase:
        dict[e.lower()] += 1

for k, v in dict.items():
    print('{} : {}'.format(k, v))



Measured memory_bytes: 6684
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <sstream>
#include <string>
#include <vector>

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

  size_t n;

  std::cin >> n;

  std::cout << n / 2 + n % 2 << "\n";

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
typedef long long ll;
using namespace std;
ll n;
int a[100010];
int dis[100010];
int main()
{
    ll sum=0;
    scanf("%lld",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    ll k;
    if((2*sum%(n*(n+1)))!=0)
    {
        printf("NO");
        return 0;
    }
    k=2*sum/(n*(n+1));
    for(int i=0;i<n;i++)
    {
        if(i==n-1)
            dis[i]=a[0]-a[i];
        else
            dis[i]=a[i+1]-a[i];
    }
    for(int i=0;i<n;i++)
    {
        if(k-dis[i]<0||(k-dis[i])%n)
        {
            printf("NO");
            return 0;
        }
    }
    printf("YES");
    return 0;
}

Measured memory_bytes: 1024
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll n;
cin>>n;
vector< vector<ll> >v(10,vector<ll>(10,0));
for(ll i=1;i<=n;i++)
{
    ll x=i;
    ll a=-1;
    ll b=-1;
    while(x>0)
    {
        ll y=x%10;
        if(b==-1)
        {
            b=y;
        }
        a=y;
        x=x/10;
    }
    v[a][b]++;
}
ll ans=0;
for(ll i=1;i<=n;i++)
{
    ll x=i;
    ll a=-1;
    ll b=-1;
    while(x>0)
    {
        ll y=x%10;
        if(b==-1)
        {
            b=y;
        }
        a=y;
        x=x/10;
    }
    if(a!=0&&b!=0)
    {
        //cout<<a<<" "<<b<<" "<<v[a][b]<<endl;
        ans+=v[b][a];
    }
}
cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#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;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

const int COL = 64;
template<int MAX_COL>
struct BitMatrix {
    int H;
    vector<bitset<MAX_COL>> A;
    BitMatrix(int m) : H(m),A(m) {}

    int GaussJordan() {
        int rank = 0;
        for (int col = 0; col < MAX_COL; ++col) {
            int pivot = -1;
            for (int row = rank; row < H; ++row) {
                if (A[row][col]) {
                    pivot = row;
                    break;
                }
            }
            if (pivot == -1) continue;
            swap(A[pivot], A[rank]);
            for (int row = 0; row < H; ++row) {
                if (row != rank && A[row][col]) A[row] ^= A[rank];
            }
            ++rank;
        }
        return rank;
    }
};

using BM = BitMatrix<COL>; 

void solve() {
    int N; cin >> N;
    vector<u64> A(N);
    rep(i,N) cin >> A[i];
    reverse(all(A));
    string S; cin >> S;
    reverse(all(S));
    BM mat(N);
    rep(i,N) {
        //cout << i << endl;
        if (S[i]=='1') {
            int MAX = mat.GaussJordan();
            int rank = 0;
            rep(bit,COL) {
                if ((A[i]>>bit)&1) {
                    while (rank < MAX) {
                        if (mat.A[rank][bit]) {
                            rep(j,COL) {
                                if (mat.A[rank][j]) A[i] ^= (1ull<<j);
                            }
                            rank++;
                            break;
                        }
                        rank++;
                    }
                }
            }
            if (A[i]) {
                cout << 1 << ln;
                return;
            }
        } else {
            rep(bit,COL) {
                if ((A[i]>>bit)&1) {
                    mat.A[i][bit] = 1;
                }
            }
        }
    }

    cout << 0 << ln;

}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int Q; cin >> Q;
    while (Q--) {
        solve();
    }
}

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

min_combi = (1, N)

for n in range(2, int(N**0.5)+1):
    if N % n == 0:
        combi = (n, int(N/n))
        if sum(min_combi)-2 > sum(combi)-2:
            min_combi = combi

print(sum(min_combi)-2)

Measured memory_bytes: 3060
require 'pp'
require 'prime'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
N, P = gets_i_list

factors = Prime.prime_division(P)

max = 1
factors.each do |num, count|
  pow = count / N
  if pow > 0
    max *= num ** pow
  end
end

puts max

Measured memory_bytes: 2684
#include <vector>
#include <iostream>
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int main()
{
    int N;
    std::cin >> N;
    std::vector<std::vector<int>> g(N);
    for (int i = 0, x, y; i < N - 1; i++) { std::cin >> x >> y, x--, y--, g[x].push_back(y), g[y].push_back(x); }
    std::vector<ll> memo[2] = {std::vector<ll>(N, -1), std::vector<ll>(N, -1)};
    auto dp = [&](auto&& self, const int s, const int p, const bool can) -> ll {
        if (memo[can][s] != -1) { return memo[can][s]; }
        ll ans1 = 1, ans2 = 1;
        for (const int to : g[s]) {
            if (to == p) { continue; }
            (ans1 *= self(self, to, s, true)) %= MOD;
            (ans2 *= self(self, to, s, false)) %= MOD;
        }
        return memo[can][s] = (can ? (ans1 + ans2) % MOD : ans1);
    };
    std::cout << dp(dp, 0, -1, true) << std::endl;
    return 0;
}


Measured memory_bytes: 44800
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = scan.nextInt();
		}
		for (int i = 0; i < n; i++) {
			y[i] = scan.nextInt();
		}
		double d1 = 0;
		double d2 = 0;
		double d3 = 0;
		double din = Math.abs(x[0] - y[0]);
		for (int i = 0; i < n; i++) {
			int xy = Math.abs(x[i] - y[i]);
			d1 += xy;
			d2 += xy * xy;
			d3 += xy * xy * xy;
			if (din < xy) din = xy;
		}
		System.out.println(d1);
		System.out.println(Math.sqrt(d2));
		System.out.println(Math.cbrt(d3));
		System.out.println(din);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 26408
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <numeric>
#include <limits>
using namespace std;

int main(void) {
	int i, j;
	string a, b;
	cin >> a >> b;
	for (i = 0; i < b.size(); i++) {
		cout << a[i] << b[i];
	}
	if (a.size() > b.size()) {
		cout << a[a.size()-1];
	}
	cout << endl;
	return 0;
}

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

# define x first    
# define y second
# define mp make_pair
// everything go according to my plan      
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector         
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right  

using namespace std;

typedef pair <int, int> pii; 
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {   
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") { 
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
int n;

int pref[Sz];

int suff[Sz];

char s[Sz];
                   
int main()
{                                  
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  cin >> n;
  cin >> s+1;
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + (s[i] == 'W');
  }       
  for (int i = n; i >= 1; i--)
    suff[i] = suff[i + 1] + (s[i] == 'E');
  int ans = n;
  for (int i = 1; i <= n; i++)
    ans = min (ans, pref[i - 1] + suff[i + 1]);
  cout << ans;


  return 0;
}






// Coded by Z..



Measured memory_bytes: 7680
#include <iostream>
using namespace std;
long long L[87];
long long Lucas(int n) {
    if (n == 0) return 2;
    if (n == 1) return 1;
    if (L[n] != 0) return L[n];
    return L[n] = Lucas(n-1) + Lucas(n-2);
}
int main() {
    int N;
    cin >> N;
    cout << Lucas(N) << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int mod=1e9+7,dp[1011][1010];
char a[1011][1011];
int main(){
	int n,m;
	cin >> n >> m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> a[i][j];
		}
	}
	dp[1][1]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
				if(i==1 && j==1 || a[i][j]=='#'){
					continue;
				}
				dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
		}
	}
	cout << dp[n][m];
}

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

nums = [i for i in range(N + 1)]
total = 0


mini = sum(nums[0:K])
maxx = sum(nums[-K:])


for i in range(K, N + 1):
    total += maxx - mini + 1

    index = i + 1
    
    if (i == N):
        break
    else:
        mini += nums[index-1]
        maxx += nums[-index]

total += 1

ans = total % (10 ** 9 + 7)


print(ans)

Measured memory_bytes: 81112
n = int(input())
a = list(map(int, input().split()))

ans = 1
up = False
down = False
for i in range(n - 1):
  if a[i] == a[i + 1]:
    continue
  if a[i] < a[i + 1]:
    up = True
    if down:
      ans += 1
      down = False
      up = False
  elif a[i] > a[i + 1]:
    down = True
    if up:
      ans += 1
      up = False
      down = False

print(ans)

Measured memory_bytes: 14252
S = input()
n = len(S)

total = 0
for i in range(2 ** (n - 1)):
    tmp = [False] * (n - 1)
    for j in range(n - 1):
        if i >> j & 1:
            tmp[j] = True

    eq = [S[0]]
    for i in range(n - 1):
        if tmp[i]:
            eq.append(",")
        eq.append(S[i + 1])

    eq = ''.join(eq)
    eq = eq.split(',')

    sum_i = 0
    for i in eq:
        sum_i += int(i)
    # print(eq, sum_i)
    total += sum_i
print(total)


Measured memory_bytes: 40304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)

long long N, X;
long long sum;

long long rec(long long a, long long b) {
	if (b == 0) return a;
	sum += (a / b) * 2 * b;
	return rec(b, a % b);
}

int main() {
	cin >> N >> X;
	sum = N;
	sum -= rec(N - X, X);
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
    double a[200000];
    int k,n,i;
    scanf("%d %d",&n,&k);
    for(i=1;i<=n;i++){
        scanf("%lf",&a[i]);
    }
    a[0]=0;
    for(i=1;i<=n;i++){
        a[i]=(1.0+a[i])*i/2.0/i;
        a[i]+=a[i-1];//前缀和
    }
    double man=0;
    for(i=k;i<=n;i++){
        double temp;
        temp=a[i]-a[i-k];
        man=max(man,temp);
    }
    printf("%.12lf",man);
}


Measured memory_bytes: 1792
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define files(name) name!=""?freopen(name".in","r",stdin),freopen(name".out","w",stdout):0
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define elif else if
#define mp make_pair
#define pb push_back
#define fir first
#define sec second

using namespace std;
#define int long long

typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;

const int arr=2e5+10;
const int ar=2e3+10;
const ld pi=acos(-1);
const ld eps=1e-10;
const ll md=1e9+7;

///---program start---///

int dp[ar][ar];
vi reb[arr];
int dp1[ar];
int max_deep_from[arr];

void minimize(int& a,int b)
{
    if (a>b){
        a=b;
    }
}

int sz_down[arr];

int K;

void dfs(int now,int pred)
{
    max_deep_from[now]=1;
    sz_down[now]=1;
    for (auto wh:reb[now]){
        if (wh!=pred){
            dfs(wh,now);
            sz_down[now]+=sz_down[wh];
            max_deep_from[now]=max(max_deep_from[now],max_deep_from[wh]+1);
        }
    }
    fill_n(dp[now],ar,1e9);
    dp[now][1]=0;
    int cur=1;
    for (auto wh:reb[now]){
        if (wh!=pred){
            fill_n(dp1,ar,1e9);
            for (int j=1;j<=cur;j++){
                for (int k=0;k<=max_deep_from[wh];k++){
                    if (j+k<=K){
                        minimize(dp1[max(j,k+1)],
                        dp[now][j]+dp[wh][k]);
                    }
                }
            }
            for (int j=0;j<ar;j++){
                dp[now][j]=dp1[j];
            }
            cur+=max_deep_from[wh];
        }
    }
    dp[now][0]=sz_down[now];
//    for (int i=0;i<=max_deep_from[now];i++){
//        cout<<"dp["<<now<<"]["<<i<<"] :: "<<dp[now][i]<<"\n";
//    }
}

main()
{
    #ifdef Barik
        files("barik");
        freopen("debug.txt","w",stderr);
    #endif

    int n,k;
    cin>>n>>k;
    k++;
    K=k;
    for (int i=1;i<n;i++){
        int u,v;
        cin>>u>>v;
        reb[u].pb(v);
        reb[v].pb(u);
    }
    dfs(1,1);
    int ans=1e9;
    for (int i=1;i<=n;i++){
        ans=min(ans,*min_element(dp[i]+1,dp[i]+k+1)+n-sz_down[i]);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 37632
import java.io.*
import java.util.*
import java.lang.Math.*


fun bitFS(S: String): Long {
    val N = S.length
    var res = 0L
    for (p in 0 until (1L shl N)) {
        var ptn = p
        if ((ptn shr (N-1)) and 1 == 0L) continue
        var sum = 0L
        var term = 0L
        for (i in 0 until N) {
            term += S[i] - '0'
            if ((ptn and 1) == 1L) {
                sum += term
                term = 0
            } else {
                term *= 10
            }
            ptn = ptn shr 1
        }
        res += sum
    }
    return res
}


fun main() {
    val (H,W, K) = rd.readIntArray()
    val C = Array(H){""}
    for (i in 0 until H){
        C[i] = rd.readString()
    }

    var ans = 0
    for (pr in 0 until (1 shl H)) {
        for (pc in 0 until (1 shl W)) {

            var black = 0
            for (i in 0 until H) {
                if ((pr shr i) and 1 == 0) continue

                for (j in 0 until W) {
                    if ((pc shr j) and 1 == 0) continue

                    if (C[i][j] == '#') black++
                }
            }

            if (black == K) ans++
        }
    }

    println(ans)
}


//val rd = debug.Reader("abc", "172", "c", "sample-2")
val rd = Reader()
fun main(args: Array<String>) {
    Thread(null, MainThread(), "mainThread", 128 * 1024 * 1024).start()
}


const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
const val EPS = 1e-9; fun DBLEQ(a: Double, b: Double): Boolean {return abs(a - b) < EPS}
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)
typealias ALI = ArrayList<Int>
fun <T>edge(V: Int): Array<ArrayList<T>> { return Array(V){ArrayList<T>()} }
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
class MainThread : Runnable {
    override fun run() { main() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 36668
from collections import deque
import sys
sys.setrecursionlimit(3000)

H,W = map(int,input().split())
maze = []
maze.append("#" * (W+2))
for i in range(H):
    k = input()
    maze.append("#" + k + "#")
maze.append("#" * (W+2))

white = 0
for m in maze:
    white += m.count(".")

d = [[1,0],[-1,0],[0,1],[0,-1]]
dist = 0
tovisit = deque()
tovisit.append([1,1]); tovisit.append([-1,-1])
visited = []
def BFS(x,y,dist):
    if x == W and y == H:
        return white - dist -1
    tovisit.popleft()
    visited.append([x,y])
    if x == -1 and y == -1:
        dist += 1
        if len(tovisit) == 0:
            return -1
        tovisit.append([-1,-1])
        return BFS(tovisit[0][0],tovisit[0][1],dist)
    for dx,dy in d:
        if maze[y+dy][x+dx] == ".":
            if [x+dx,y+dy] not in visited and [x+dx,y+dy] not in tovisit:
                tovisit.append([x+dx,y+dy])
    return BFS(tovisit[0][0],tovisit[0][1],dist)

print(BFS(1,1,0))

Measured memory_bytes: 5612
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int x;
	cin >> x;
	int minsq = (int)std::ceil(std::sqrt(x));
	
//	cout << "minsq:" << minsq << endl;
	
	bool check = true;
	bool loopcheck = true;
	int ans=x;
	
	if(ans == 2 ) {
		cout << 2 << endl;
		return 0;
	}
	
	while(loopcheck){
		check = true;
		for(int i = 2;i<=minsq; i++){
			if(ans % i == 0) {
				
//				cout << "loop, i:" << i << ", x:" << ans << endl;
				
				check = false;
				break;
			}
		}
		if (check){
			loopcheck = false;
		} else{
			ans++;
		}
	}
	
	cout << ans << endl;
	


	return 0;
}


Measured memory_bytes: 256
#include <iostream>

constexpr int MAX_N=(int)1e5;

int n;

int p[MAX_N];

int main() {

    std::cin>>n;

    for(int i=0;i<n;++i)
        std::cin>>p[i];

    int ans=0,cnt=0;

    for(int i=0;i<n;++i){
        if(p[i]==i+1)
            ++cnt;
        else{
            ans+= (cnt<=1)? cnt : (cnt+1)/2;
            cnt=0;
        }
    }

    ans+= (cnt<=1)? cnt : (cnt+1)/2;

    std::cout<<ans<<std::endl;

    return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  
  string s; cin >> s;
  int ans = 0;

  rep(i, si(s)) if (s[i] == '1') ++ans;
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+10;
vector<int> datas[MAXN];//通道关系
int ans[MAXN];//保存最近的房间号
 
void bfs() {
    queue<int> q;
    q.push(1);
    ans[1] = 1;
 
    while (!q.empty()) {
        int u = q.front();
        q.pop();
 
        for (auto v:datas[u]) {
            if (0==ans[v]) {
                q.push(v);
                ans[v] = u;
            }
        }
    }
}
 
int main() {
    int n,m;
    scanf("%d%d", &n, &m);
    for (int i=0; i<m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        datas[u].push_back(v);
        datas[v].push_back(u);
    }
 
    bfs();
 
    //查询
    for (int i=2; i<=n; i++) {
        if (0==ans[i]) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    for (int i=2; i<=n; i++) {
        printf("%d\n", ans[i]);
    }
 
    return 0;
}

Measured memory_bytes: 12896
#include <iostream>
#include <string>
using namespace std;
 
/*int main() {
  int N;
  cin >> N;
  int max=0;
  int tsk=1;
  for(int i = 0;i<N;i++){
    int res=0;
    while(true){
      if(i%N==0) ++res;
      else break;
      i/=2;
    }
    if(max < res){
      max = res;
      tsk=i;
    }
  }
  cout << tsk << endl;
}*/

int main(){
  int N;
  cin >> N;
  if(N >= 64) cout << 64 << endl;
  else if(N >= 32) cout << 32 << endl;
  else if(N >= 16) cout << 16 << endl;
  else if(N >=  8) cout << 8 << endl;
  else if(N >= 4) cout << 4 << endl;
  else if(N >= 2) cout << 2 << endl;
  else  cout << 1 << endl;

}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if (s.size() < 26) {
	for (char c = 'a'; c <= 'z'; c++) {
	  if (s.find(c)==-1) {
		cout << s << c << endl;
		return 0;
      }
	}
  }
  else {
    set<char> x;
	while (!s.empty()) {
	  char c = s.back();
	  x.insert(c);
	  s.pop_back();
	  if (c !=*x.rbegin()) {
	    cout<< s << *x.upper_bound(c) << endl;
	    return 0;
	  }
    }
	cout << -1 << endl;
  }
}


Measured memory_bytes: 256
package main


import (
  "fmt"
  // "strings"
  // "strconv"
)


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


func main () {
  var a, b int
  fmt.Scanf("%d %d", &a, &b)
  fmt.Println(max(max(a+b, a-b), a*b))
}




Measured memory_bytes: 512
N = int(input())
mod = pow(10,9)+7
A = [1]*(N+1)
for i in range(1,N+1):
    n = i
    for j in range(2,i+1):
        if j>n:break
        while n%j==0:
            A[j]+=1
            n//=j
cnt = 1
for i in range(N+1):
    cnt *= A[i]
print(cnt%mod)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;
ll const MOD = 1000000007;


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

string s;
cin >> s;

int cnt = 0;
rep(i,s.size()) {
    if(s[i] == '1') cnt++;
}

cout << cnt << endl;


return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline


def main():
    nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4,
            1, 4, 1, 51]
    print(nums[int(input()) - 1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main (void) {

    vector<unsigned int> ns;
    vector<unsigned int> ps;

    unsigned int tn, tp;
    unsigned int dataset_size = 0;
    unsigned int count = 0;
    do {
        cin >> tn >> tp;
        ns.push_back(tn);
        ps.push_back(tp);
        dataset_size++;
    } while (tn != 0 || tp !=0);

    for (int x=0; x<dataset_size-1; x++) {
        count = 0;
        tn = ns[x];
        tp = ps[x];

        int has_p[tn];
        for (unsigned int i=0; i<tn; i++)
            has_p[i] = 0;

        unsigned int i = 0;
        do {
            if (tp == 0) {
                tp = has_p[i];
                has_p[i] = 0;
            } else {
                tp--;
                if ((++has_p[i]) == ps[x]) { break; }
            }
            i = (++i % tn);
            count++;
        } while (true);
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 1208
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**6)

def dfs(balls,B=-1,C=-2,cp=0):
	if cp==len(balls): 	return True
	ball = balls[cp]
	if B<ball:
		is_find = dfs(balls,ball,C,cp+1)
		if is_find: return True
	if C<ball:
		is_find = dfs(balls,B,ball,cp+1)
		if is_find: return True
	return False

def not_dfs(balls):
	B, C = -2, -1
	for ball in balls:
		if C<ball:
			C = ball
			continue
		if B<ball:
			B = ball
			continue
		return False
	return True

def main():
	N = int(input().strip())
	for _ in range(N):
		balls = list(map(int,input().split(' ')))
#		is_find = dfs(balls)
		is_find = not_dfs(balls)
		if is_find:		print('YES')
		else:			print('NO')

if __name__=='__main__':
	main()

"""
2
3 1 4 2 5 6 7 8 9 10
10 9 8 7 6 5 4 3 2 1
"""

Measured memory_bytes: 7656