akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define UMap        std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd   ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm   ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs   ( llong n )          { return ( n < 0 ) ? -n : n; }
    template<class A, class B>inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B>inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int q, w;
        read q >> w;
        echo ( q - w + 1 ) fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); echo std::fixed << std::setprecision(8); int main_result = Rlyeh::call_of_Cthulhu(114514); return main_result;}


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

using ll = long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    string S;
    cin >> S;

    ll slots = S.size() -1;
    ll n = 1 << slots;

    ll ans = 0;

    for (int combi = 0; combi < n; combi++) {
        int p = 0;
        for (int i = 0; i < slots; i++) {
            if (combi & (1 << i)) {
                ans  += stoll(S.substr(p, i+1-p));
                p = i + 1;
            }
        }
        ans  += stoll(S.substr(p, S.size() - p +1));
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int[] icecle;
	P[] pair;
	int[] mem;
	int n, l;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		l = sc.nextInt();
		mem = new int[n+2];
		icecle = new int[n+2];
		pair = new P[n+2];
		pair[0] = new P(0, INF);
		pair[n+1] = new P(0, INF);
		fill(mem, 0);
		for(int i=1;i<=n;i++) {
			icecle[i] = sc.nextInt();
			pair[i] = new P(i, icecle[i]);
		}
		sort(pair, new MyComp());
		long max = 0;
		mem[n+1] = 0;
		mem[0] = 0;
		for(int i=0;i<n;i++) {
//			debug(pair[i].x);
			mem[pair[i].x] = max(mem[pair[i].x-1], mem[pair[i].x+1]) + time(pair[i].x);
			max = max( max, mem[pair[i].x] );
		}
		System.out.println(max);
	}
	
	int time(int x) {
		return  l - icecle[x] ;
	}
	class MyComp implements Comparator<P> {

		@Override
		public int compare(P o1, P o2) {
			// TODO 自動生成されたメソッド・スタブ
			return o1.y -o2.y;
		}
		
	}
	
	class P {
		int x, y;
		P (int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 16000
#include <iostream>

using namespace std;
int main() {
    int count = 0;
    string s;
   cin >> s;
   for(int i=0;i<6;i++){
       char c = s[i];
       if(c == 0x31){
           count++;
       }
   }
    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string s;
  cin >> s;
  int ans = 700;
  REP(i, 3) if(s[i] == 'o') ans += 100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = gets.chomp.split(' ').map(&:to_i)
a = [0, 0, 0, 0]
4.times do |i|
  if n[i] == 1
    a[0] += 1
  elsif n[i] == 9
    a[1] += 1
  elsif n[i] == 7
    a[2] += 1
  elsif n[i] == 4
    a[3] += 1
  end
end

if a[0] == 1 && a[1] == 1 && a[2] == 1 && a[3] == 1
  puts "YES"
else
  puts "NO"
end


Measured memory_bytes: 1788
//      https://youtu.be/X_hMZYDMps4

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

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;    // 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define nl                  "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define pf                  push_front
#define all(x)              x.begin(),x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"

int main()
{
    fast;
    ll t,i,j,k,l,m,n,o,p,q,temp,flag=0,mod=1000000007;
    cin>>n>>k;
    ll a[n],ans[n];
    for(i=0;i<n;i++){
        cin>>a[i];
        ans[i]=inf;
    }
    ans[0]=0;
    for(i=1;i<n;i++){
        for(j=i-1;j>=i-k&&j>=0;j--){
            ans[i]=min(ans[i],ans[j]+abs(a[i]-a[j]));
        }
    }
    cout<<ans[n-1];
}


Measured memory_bytes: 5152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define eps 1e-9
#define maxp 1004
#define mod 998244353
#define sin(s) scanf("%lld",&s);
#define sout(s) printf("%lld\n",s);
#define in(s) cin>>s
#define in2(a,b) cin>>a>>b
#define in3(a,b,c) cin>>a>>b>>c
#define vll vector<ll>
#define out(s) cout<<s
#define outs(s,a) cout<<s<<a
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gear_change ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define nfl(i,n) for(i=0;i<n;i++)
#define sfl(i,s,e) for(i=s;i<e;i++)
#define ufl(i,n) for(i=n-1;i>=0;i--)
void solve(){
    ll x,y,z;
    in3(x,y,z);
    cout<<z<<" "<<x<<" "<<y<<'\n';
}
int main(){
    clock_t t1=clock();
    gear_change;
    ll test=1;
    // in(test);
    // cout<<"\nasd";
    while(test--){
        solve();
    }
    clock_t t2=clock();
    cerr<<"Time elapsed:- "<<(double)(t2-t1)/CLOCKS_PER_SEC<<'\n';
}    

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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 h, w;
vector<vector<char>> s;

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

void solve() {
	cin >> h >> w;
    s.assign(h, vector<char>(w));
    rep(i, h) {
        rep(j, w) {
            cin >> s[i][j];
        }
    }
    deque<P> deq;
    vector<vector<int>> dist(h, vector<int>(w, inf));
    dist[0][0] = (s[0][0] == '#' ? 1 : 0);
    deq.push_front({0, 0});
    while(!deq.empty()) {
        P p = deq.front(); deq.pop_front();
        int i = p.fr, j = p.sc;
        rep(a, 2) {
            int ni = i + dx[a], nj = j + dy[a];
            if(0 <= ni && ni < h && 0 <= nj && nj < w ) {
                if(s[i][j] == '.' && s[ni][nj] == '#') {
                    if(chmin(dist[ni][nj], dist[i][j] + 1)) {
                        deq.push_back({ni, nj});
                    }
                } else {
                    if(chmin(dist[ni][nj], dist[i][j])) {
                        deq.push_back({ni, nj});
                    }
                }
            }
        }
    }
    // rep(i, h) {
    //     rep(j, w) {
    //         cerr << i << " " << j << " " << dist[i][j] << endl;
    //     }
    // }
    cout << dist[h - 1][w - 1] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

typedef long long ll;

int main(void) {

    ll x; cin >> x;
    ll cnt = (x/11)*2;
    x = x%11;
    if (!(x == 0)) {
        if (x <= 6) cnt++;
        else cnt += 2;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define F first 
#define S second
const  ll N = 100111 ;
int n ; 
int main()
{
	cin >> n ;
	if(n % 4 == 1){
		n /= 4 ; 
		int ans = 0 ;
		for(int i = 1 ; i <= 4*n+1 ; i ++){
			for(int j = i+1 ; j <= 4*n+1 ; j ++){
				if(j + i == 4*n+1)	
					continue ;
				ans ++ ;
			}
		}
		cout << ans << endl ;
		for(int i = 1 ; i <= 4*n+1 ; i ++){
			for(int j = i+1 ; j <= 4*n+1 ; j ++){
				if(j + i == 4*n+1)	
					continue ;
				cout << i << " " << j << endl ;
			}
		}
		return 0 ;
	}
	if(n % 4 == 2){
		n /= 4 ; 
		int ans = 0 ;
		for(int i = 1 ; i <= 4*n+2 ; i ++){
			for(int j = i+1 ; j <= 4*n+2 ; j ++){
				if(j + i == 4*n+3)	
					continue ;
				ans ++ ;
			}
		}
		cout << ans << endl ;
		for(int i = 1 ; i <= 4*n+2 ; i ++){
			for(int j = i+1 ; j <= 4*n+2 ; j ++){
				if(j + i == 4*n+3)	
					continue ;
				cout << i << " " << j << endl ;
			}
		}
		return 0 ;	
	}
	vector<int> a, b;
	if(n % 4 == 3){
		a.push_back(1) ;
		a.push_back(2) ;
		b.push_back(3) ;
		for(int i = 4 ; i <= n ; i += 4){
			a.push_back(i) ;
			a.push_back(i+3) ;
			b.push_back(i+2) ;
			b.push_back(i+1) ;
		}
	}
	if(n % 4 == 0){
		for(int i = 1 ; i <= n ; i += 4){
			a.push_back(i) ;
			a.push_back(i+3) ;
			b.push_back(i+2) ;
			b.push_back(i+1) ;
		}
	}
	cout << (a.size()) * (b.size()) << endl ;
	for(int i = 0 ; i < a.size() ; i ++){
		for(int j = 0 ; j < b.size() ; j ++){
			cout << a[i] << " " << b[j] << endl ;
		}
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cassert>
#include<ctime>
#include<climits>
#include<queue>
#include<fstream>
#include<deque>
#include<iomanip>
#include<list>
#include<stack>
#include<sstream>
#include<string>
#include<cctype>
#include<cstdio>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<set>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-10
#define F first
#define S second
#define all(n) n.begin(),n.end()
#define pb push_back
#define insert(a,b,c,d) PP(P(a,b),P(c,d))
#define INF (1<<27)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};

int main(){
  string s;
  cin >> s;
  int cnt = 0;
  //int lim = s.length()%2==0?s.length()/2:s.length()/2+1;
  //cout << s.length()/2 << endl;
  for(int i=0;i<s.length()/2;i++){
    if(!((s[i] == s[s.length()-1-i] && s[s.length()-1-i]!='(' && s[s.length()-1-i] != ')' && s[i] != '(' && s[i] != ')') || (s[i] == '(' && s[s.length()-1-i] == ')' || (s[i] == ')' && s[s.length()-1-i] == '('))))cnt++;
    //cout << s[i] << " " << s[s.length()-1-i] << endl;
  }
  //cout << s[s.length()/2] << endl;
  if(s.length()%2 != 0 && (s[s.length()/2] == '(' || s[s.length()/2] == ')'))cnt++;

  cout << cnt << endl;
return 0;
}

Measured memory_bytes: 1180
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

istream& operator>> (istream& a, pii& b) {
    cin >> b.first >> b.second;
    return a;
}

ostream& operator<< (ostream& a, const pii& b) {
    cout << "{" << b.first << ", " << b.second << "}";
    return a;
}

template <typename T1, typename T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template <typename T1, typename T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e5;
    // const int mod = 2600000069;
    // const int p = 10;
    // const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18 + 10;
    // const int mod = 2600000069;
    // const int p = 179;
    // const ld PI = 3.1415926535;
#endif

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")  
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    char c;
    cin >> c;
    if (c >= 'a' && c <= 'z') {
        cout << 'a';
    } else cout << 'A';
}
/*

*/

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using lld = int64_t;
const int N = 100000 + 5;

int a[ N ], s[ N ];
lld bit[ N << 1 ];

lld query( int p ) {
	lld ret = 0;
	while ( p ) {
		ret += bit[ p ];
		p -= p & (-p);
	}
	return ret;
}
void add( int p, int x ) {
	while ( p < N + N ) {
		bit[ p ] += x;
		p += p & (-p);
	}
}

lld calc( int m, int n ) {
	for ( int i = 1 ; i <= n ; ++ i )
		if ( a[ i - 1 ] >= m ) s[ i ] = s[ i - 1 ] + 1;
		else s[ i ] = s[ i - 1 ] - 1;
	memset( bit, 0, sizeof( bit ) );
	lld ret = 0;
	for ( int i = 0 ; i <= n ; ++ i ) {
		ret += query( s[ i ] + N );
		add( s[ i ] + N, 1 );
	}
	return ret;
}

int main() {
	int n; scanf( "%d", &n );
	for ( int i = 0 ; i < n ; ++ i )
		scanf( "%d", a + i );
	lld tot = 1LL * n * ( n + 1 ) / 2;
	int l = 1, r = 1000000001;
	while ( r - l > 1 ) {
		int m = ( l + r ) >> 1;
		if ( calc( m, n ) * 2 >= tot ) l = m;
		else r = m;
	}
	cout << l << '\n';
	return 0;
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,l;
    cin >> n >> l;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int lst=-1;
    for(int i = 1; i < n; i++) {
        if(a[i-1]+a[i]>=l){
            lst=i;
            break;
        }
    }

    if(lst==-1){
        cout << "Impossible" << "\n";
        return 0;
    }

    cout << "Possible" << "\n";
    for(int i = 1; i < lst; i++) {
        cout << i << "\n";
    }
    for(int i = n-1; i > lst; i--) {
        cout << i << "\n";
    }
    cout << lst << "\n";

    return 0;
}

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

using namespace std;


void solve() {
    int n, m;
    cin >> n >> m;
    int ML=0, mR=1e6;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        ML = max(ML, x);
        mR = min(mR, y);
    }
    int res = ML > mR ? 0: mR-ML+1;
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
pair<int, int> E[100001];
int H[100001];
int n[100001], kari[100001];
int sagasu(int A) {
	if (n[A] == n[A - 1]) return 0;
	if (n[A] == n[A - 1] + 1) {
		return sagasu(E[H[A]].first) + 1;
	}
	int k = n[A - 1];
	for (int i = H[A]; i; i = E[i].second) {
		kari[k++] = sagasu(E[i].first);
	}
	sort(kari + n[A - 1], kari + n[A], greater<int>());
	int ret = 0;
	for (int i = 0; i < n[A] - n[A - 1]; i++) ret = max(ret, kari[n[A - 1] + i] + i);
	return ret + 1;
}

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


	int N = getint();

	for (int i = 2; i <= N; i++) {
		int a = getint();
		n[a]++;
		E[i] = mp(i, H[a]);
		H[a] = i;
	}
	rep1(i, N) n[i] = n[i - 1] + n[i];

	printf("%d\n", sagasu(1));

	Would you please return 0;
}

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

void rev(int *a,int *b){
  int tmp;
  if(*b>*a){
    tmp=*b;
    *b=*a;
    *a=tmp;
  }
}

int main(){
  int a,b,c,tmp,count = 0;
  cin>>a>>b>>c;
  rev(&a,&b);
  rev(&b,&c);
  rev(&a,&b);
  
  while(1){
    
    if(a==b&&b==c){
      break;
    }
    if(a>b){
      b++;
      c++;
    }else if(c<a){
      c=c+2;
    }else{
      a++;
      b++;
    }
    count++;
  }
  cout<< count << endl;
  return 0;
}


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

int main(void)
{
    //char z,x;
    //int a,b,c;
    string a,b,c;
    cin>>a>>b>>c;
    cout<<a[0]<<b[1]<<c[2];
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(i=0; i<n; i++)

int main(void)
{
	int i, n, k, d, min;
	scanf("%d%d", &k, &n);
	int a[n];
	rep(i,n) scanf("%d", &a[i]);

	min = a[n-1]-a[0];
	for(i=1; i<n; i++){
		d = k-(a[i]-a[i-1]);
		if(d<min){
			min = d;
		}
	}
	printf("%d", min);
	return 0;
}

Measured memory_bytes: 1024
using System;
class abc148_b{
  public static void Main(){
    int n = int.Parse(Console.ReadLine());
    String[] str = Console.ReadLine().Split(' ');
    String s = str[0];
    String t = str[1];
    String ans = "";
    for(int i=0; i<n; i++){
      ans += s[i];
      ans += t[i];
    }
    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> isPair;
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;

const ll inf=1e10;
const ll maxs = 201;
const ll mod = 1e9+7;

#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define line cout<<endl;
#define fr(i,b) for(ll i=1;i<=b;++i)
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

ll n,W;

void solve()
{
    ll val[n+1],w[n+1];
    ll sum = 0;
    for(ll i=1;i<=n;i++)
    {
        cin>>w[i]>>val[i];
        sum+=val[i];
    }
    ll dp[sum+1];
    for(ll i=0;i<=sum;i++)
        dp[i]=inf;
    dp[0]=0;
    for(ll i=1;i<=n;i++)
    {
        ll curr_w = w[i];
        ll curr_val = val[i];
        for(ll j=(sum-curr_val);j>=0;j--)
        {
            dp[j+curr_val] = min(dp[j+curr_val] , dp[j]+curr_w);
        }
    }
    ll index=0;
    for(ll i=sum;i>=0;i--)
    {
        if(dp[i]<=W)
        {
            index=i;
            break;
        }
    }
    cout<<index<<endl;
}

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



Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
string s;
ll n;
cin>>n;
cin>>s;
int r[4001];
int g[4001];
int b[4001];
int sr=0,sg=0,sb=0;
ll ans=0;
for(int i=0;i<n;i++)
{
if(s[i]=='R')
{
sr++;
}
else if(s[i]=='G')
{
sg++;
}
else 
{
sb++;
}
r[i]=sr;g[i]=sg;b[i]=sb;
}
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(s[i]==s[j]){continue;}
if((s[i]=='R' && s[j]=='G') || (s[i]=='G' && s[j]=='R'))
{
ans+=b[n-1]-b[j];
if(s[2*j-i]=='B')
{
ans--;
}
}
else if((s[i]=='R' && s[j]=='B') || (s[i]=='B' && s[j]=='R'))
{
ans+=g[n-1]-g[j];
if(s[2*j-i]=='G')
{
ans--;
}
}
else if((s[i]=='G' && s[j]=='B') || (s[i]=='B' && s[j]=='G'))
{
ans+=r[n-1]-r[j];
if(s[2*j-i]=='R')
{
ans--;
}
}
}
}
cout<<ans;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=100,MAX_S=100;
int N;
int main(){
	cin>>N;
	bitset<MAX_N*MAX_S+1> bs;
	bs[0]=1;
	REP(i,N){
		int s;
		cin>>s;
		bs|=bs<<s;
	}
	int ans=0;
	for(int i=MAX_N*MAX_S;i>=0;i--){
		if (bs[i] && i%10){
			ans=i;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int n;cin>>n;
  ll t, a;
  for(int i=0;i<n;i++){
    ll p, q;cin>>p>>q;
    if(i==0){t=p;a=q;}
    else{
      ll dt=ll(t/p)+ll(t%p!=0), da=ll(a/q)+ll(a%q!=0);
      if(dt<da)swap(dt, da);
      t=dt*p;a=dt*q;
    }
  }
  cout<<ll(t+a)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  map<char,ll> M;
  ll N; cin>>N>>M['A']>>M['B']>>M['C'];
  if(M['A']+M['B']+M['C']==0){
    cout<<"No"<<endl; return 0;
  }
  vector<string> Z(N+1,"xx");
  vector<char> ans(0,0);
  bool out=false;
  for(int i=0; i<N; i++) cin>>Z[i];
  for(int i=0; i<N; i++){
    char x=Z[i][0], y=Z[i][1];
    char xx=Z[i+1][0], yy=Z[i+1][1];
    if(M[x]==0 && M[y]==0){
      out=true;
      break;
    }
    else if(M[x]==0) M[x]++, M[y]--, ans.emplace_back(x);
    else if(M[y]==0) M[x]--, M[y]++, ans.emplace_back(y);
    else if(M[x]==1 && M[y]==1){
      if(xx=='x') ans.emplace_back(x);//おしまい
      else if(x==xx || x==yy) M[x]++, M[y]--, ans.emplace_back(x);
      else if(y==xx || y==yy) M[x]--, M[y]++, ans.emplace_back(y);
    }
    else{
      if(M[x]>=M[y]) M[x]--,M[y]++,ans.emplace_back(y);
      else M[x]++,M[y]--,ans.emplace_back(x);
    }
  }
  ll asz=ans.size();
  if(out) cout<<"No"<<endl;
  else{
    cout<<"Yes"<<endl;
    for(int i=0; i<asz; i++) cout<<ans[i]<<endl;
  }
}

Measured memory_bytes: 6740
#include<iostream>
using namespace std;
int get(int x){
  int ans=0;
  while(x)x/=10,ans++;
  return ans;
}
int main(){
  int n;
  cin>>n;
  int ans=0;
  for(int i=1;i<=n;i++)ans+=(get(i)%2);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys

def popcount(i):
    K = i
    d = 0
    while K > 0:
        d += K % 2
        K //= 2
    return d

def solve():
    input = sys.stdin.readline
    N = int(input())
    X = input().strip("\n")
    countOne = X.count("1")
    modM = [0] * N
    modP = [0] * N
    minusS, plusS = 0, 0
    for i in range(N):
        if X[N-i-1] == "1":
            if countOne > 1: 
                modM[i] = pow(2, i, countOne - 1)
                minusS += modM[i]
                minusS %= (countOne - 1)
            modP[i] = pow(2, i, countOne + 1)
            plusS += modP[i]
            plusS %= (countOne + 1)
    Ans = [0] * N
    for i in range(N):
        if X[i] == "0":
            start = (plusS + pow(2, N - i - 1, countOne + 1)) % (countOne + 1)
            Ans[i] = 1
            while start > 0:
                d = popcount(start)
                Ans[i] += 1
                start %= d
        else:
            if countOne > 1:
                start = (minusS - modM[N - i -1]) % (countOne - 1)
                Ans[i] = 1
                while start > 0:
                    d = popcount(start)
                    Ans[i] += 1
                    start %= d
    print(*Ans, sep = "\n")

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 81824
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;

lli mod197 = 1000000007LL;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli A, B;
	cin >> A >> B;

	for (int i = B - A + 1; i < B + A; i++) {
		cout << i << ((i == B + A - 1) ? '\n' : ' ');
	}


	return 0;
}

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



int main() {
    int N;
    cin>>N;
    N--;
    cout<<N/2<<endl;
}

Measured memory_bytes: 256
import sys
N = int(input())

dp = [10 ** 9 + 7] * (N + 1)
dp[0] = 0
for n in range(N+1):
    pow = 1
    while pow <= n:
        dp[n] = min(dp[n], dp[n-pow] + 1)
        pow *= 6
    pow = 1
    while pow <= n:
        dp[n] = min(dp[n], dp[n-pow] + 1)
        pow *= 9

print(dp[-1])

Measured memory_bytes: 3828
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cstring>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}
/*
ll Integer_factorization(ll n){
    ll num = 0;
    ll ndash = n;
    if(n == 1) return 1;
    ll a = 2;
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    return num;
}
*/

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}

void solve() {
    int a,b,c;
    //cin >> a >> b;
    int n;
    cin >> n;
    string ans = "No";
    //for(int i = 0;i < n;i++) cin >> a[i];
    for(int i = 1;i < 10;i++){
        if(n%i == 0 &&  n/i < 10) ans = "Yes";
    }
    cout << ans << endl;
    
}




int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000*1000*1000+7;
long long n, curr, suma, wynik;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n;
    for(long long i = 1; i <= n; i++)
    {
        cin >> curr;
        wynik = (wynik +  curr * suma) % MOD;
        suma = (suma + curr) % MOD;
    }
    cout << wynik % MOD << "\n";
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
ll h[200009];
ll b[200009];
ll a[200009];
ll tree[10000009];
bool cmp(ll x,ll y){
	return h[x]>h[y];
}
ll query(int node,int l,int r,int s,int e){
	if(s<=l && e>=r){
		return tree[node];
	}
	if(s<=(l+r)/2 && e>=(l+r)/2+1) return max(query(node*2,l,(l+r)/2,s,e),query(node*2+1,(l+r)/2+1,r,s,e));
	else if(s<=(l+r)/2) return query(node*2,l,(l+r)/2,s,e);
	else return query(node*2+1,(l+r)/2+1,r,s,e);
}
void upd(int node,int l,int r,int k,ll x){
	if(l==r){
		tree[node]=x;
		return;
	}
	if(k<=(l+r)/2) upd(node*2,l,(l+r)/2,k,x);
	else upd(node*2+1,(l+r)/2+1,r,k,x);
	tree[node]=max(tree[node*2],tree[node*2+1]);
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>h[i];
	for(int i=0;i<n;i++)cin>>b[i];
	for(int i=0;i<n;i++)a[i]=i;
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++){
		ll bu=b[a[i]];
		int id=a[i];
		ll mx=query(1,0,n-1,id,n-1);
		upd(1,0,n-1,id,mx+bu);
	}
	cout<<query(1,0,n-1,0,n-1)<<endl;
}


Measured memory_bytes: 11392
N,K,C=map(int,input().split())
S=input()
A=[0]*N
B=[0]*N
a=0
b=N-1
for i in range(K):
  j=K-1-i
  while S[a]=='x':
    a+=1
  while S[b]=='x':
    b-=1
  A[i]=a
  a+=1+C
  B[j]=b
  b-=1+C
for i in range(K):
  if A[i]==B[i]:
    print(A[i]+1)

Measured memory_bytes: 20624
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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



void solve(std::string S){
    if(S[S.size()-1]=='s'){
        cout<<S+"es"<<endl;
    }else{
        cout<<S+"s"<<endl;
    }
}

// Generated by 1.1.7.1 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: 3628
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int L,R,d,i,count=0;
    cin>>L>>R>>d;

    for(i=L;i<=R;i++)
    {
        if(i%d==0)
            count++;
    }

    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n;
  cin>>n;
  vector<vector<int>> v(n);
  rep(i,n-1){
    int a,b;cin>>a>>b;
    a--,b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  vector<int> a(n),b(n);
  int c=0;
  rep(i,n){
    cin>>b[i];
    c+=b[i];
  }
  sort(all(b),greater<int>());
  cout<<c-b[0]<<endl;
  queue<int> q;
  q.push(0);
  int cnt=0;
  map<P,bool> m;
  while(!q.empty()){
    int p=q.front();
    q.pop();
    a[p]=b[cnt];
    cnt++;
    for(auto au:v[p]){
      if(!m[P(min(p,au),max(p,au))]){
        q.push(au);
        m[P(min(p,au),max(p,au))]=true;
      }
    }
  }
  rep(i,n){
    cout<<a[i]<<" ";
  }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int a[32] = {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};
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  cin >> k;
  cout << a[--k] << endl;
}

Measured memory_bytes: 3596
#include <stdio.h>
     
    int main(void) {
      int a[3][3], n, b[10];
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          scanf("%d", &a[i][j]);
        }
      }
      scanf("%d", &n);
     
      for (int i = 0; i < n; i++) {
        int b;
        scanf("%d", &b);
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            if (a[i][j] == b) {
              a[i][j] = 0;
            }
          }
        }
      }
     
      int flag = 0;
      int bingo[4] = {};
      for (int i = 0; i < 3; i++) {
        bingo[0] = bingo[1] = 0;
        for (int j = 0; j < 3; j++) {
          if (a[i][j] == 0) bingo[0]++;
          if (a[j][i] == 0) bingo[1]++;
          if ((i == j) && (a[i][j] == 0)) bingo[2]++;
          if (((i + j) == 2)  && (a[i][j] == 0)) bingo[3]++;
        }
        if ((bingo[0] == 3) || (bingo[1] == 3))flag = 1;
        
      }
      if ((bingo[2] == 3) || (bingo[3] == 3))flag = 1;
     
      if (flag)
      {
          printf("Yes\n");
      }else
      {
          printf("No\n");
      }
      
      
      
    }

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

mem = dict()
for a in A:
    if a in mem.keys():
        mem[a] += 1
    else:
        mem[a] = 1

v = sorted(mem.values())
if len(v) > K:
    print(sum(v[:len(v)-K]))
else:
    print(0)


Measured memory_bytes: 41120
N = int(input())
def make_divisors(n):
    divisors = []
    divisors.append(1)
    ans=0
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            #divisors.append(i)
            #print(i)
            if(N%(i-1)==N//(i-1)):
                ans+=i
            if i != n // i:
                #divisors.append(n//i)
                if(N%(n//i-1)==N//(n//i-1)):
                    ans+=n//i-1
                #print(n//i)
    if(N%(N-1)==N//(N-1)):
        ans+=N-1
    print(ans)
    return divisors

if(N==1):
    print(0)
else:
    res = make_divisors(N)
#print(res)

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
    int key;
    struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

Node * find(Node *u, int k){
    while(u != NIL && k != u->key) {
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}       

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key   = k;
    z->left  = NIL;
    z->right = NIL;
    
    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if( z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
    
int main(void) {
    int n, i, x;
    char com[16];
    scanf("%d",&n);
    
    for(i=0;i<n;i++) {
        scanf("%s",com);
        if(com[0] == 'f') {
            scanf("%d",&x);
            Node *t = find (root,x); 
            if(t != NIL) printf("yes\n");
            else printf("no\n");
        }else if(!strcmp(com,"insert")) {
            scanf("%d" ,&x);
            insert(x);
        } else if(!strcmp(com,"print")) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 20452
#include <iostream>
using namespace std;
typedef long long int ll;

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

int h,w;
char fi[55][55];

bool ok(int y,int x){
	if(0<=y&&y<h&&0<=x&&x<w)return true;
	else return false;
}

int main(){
	cin >> h >> w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> fi[i][j];
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(fi[i][j]=='#'){
				bool can=false;
				for(int k=0;k<4;k++){
					int ny=i+dy[k],nx=j+dx[k];
					if(ok(ny,nx)==false)continue;
					if(fi[ny][nx]=='#')can=true;
				}
				if(can==false){
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

#define MP make_pair
#define PB push_back
#define ll long long int
#define F first
#define S second
#define MAX(x,y) (x)>(y)?(x):(y)
#define MIN(x,y) (x)<(y)?(x):(y)
#define REP(i,n) for(i=0;i<(n);i+=1)
#define REP1(i,n) for(i=1;i<(n);i+=1)
#define REPr(i,n) for(i=n-1;i>=0;i-=1)
#define LOOP(i,n) for(i=1;i<=(n);i+=1)

typedef vector<int> vi;
typedef vector<ll> vll;
typedef set<int>::iterator sit;
typedef unordered_set<int>::iterator usit;
typedef multiset<int>::iterator msit;
typedef unordered_multiset<int>::iterator umsit;
typedef vector<ll>::iterator vllit;

ll MAX3(ll x, ll y, ll z){
    ll temp = max(x,y);
    return max(temp,z);
}

//cin.ignore(numeric_limits<streamsize>::max(),'\n');

const int N = 100001;
ll dp[3][N];
vi v[3];
int n;

void solve(){

    int i,j,x;
    dp[0][0]=v[0][0];
    dp[1][0]=v[1][0];
    dp[2][0]=v[2][0];
    REP1(i,n){
        REP(x,3){
            for(j=0; j<3;j+=1){
                if(j!=x)
                    dp[x][i] = max(dp[x][i], dp[j][i-1] + v[x][i] );
            }
        }
    }
}

/*void solve(){

    int i,j;
    dp[0][0]=v[0][0];
    dp[1][0]=v[1][0];
    dp[2][0]=v[2][0];
    REP1(i,n){
        dp[0][i] = max(dp[1][i-1], dp[2][i-1]) + v[0][i];
        dp[1][i] = max(dp[0][i-1], dp[2][i-1]) + v[1][i];
        dp[2][i] = max(dp[0][i-1], dp[1][i-1]) + v[2][i];
    }

}*/

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

    cin>>n;
    int i,a,b,c;
    REP(i,n){
        cin>>a>>b>>c;
        v[0].PB(a);
        v[1].PB(b);
        v[2].PB(c);
    } 
    solve();
    ll ans = 0;
    REP(i,3){
        ans = max(ans, dp[i][n-1]);
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 4076
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>

#define lli long long int
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))

lli f(lli b,lli n){
	if(n < b){
		return n;
	}
	return f(b,n / b) + n % b;
}
bool judge(lli b,lli n,lli s){
	return f(b,n) == s;
}


int main(void){
	lli i;
	lli n,s;
	lli sqrtn;
	lli b;
	scanf("%lld",&n);
	scanf("%lld",&s);
	if(s==n){
		printf("%lld\n", n+1);
		return 0;
	}
	sqrtn = (lli)sqrt((double)n);
	for(i=2;i<=sqrtn;i++){
		if(judge(i,n,s)){
			printf("%lld\n", i);
			return 0;
		}
	}
	for(i=sqrtn;i>=1;i--){
		b = (n - s) / i + 1;
		if(b <= 1){
			continue;
		}
		if(judge(b,n,s)){
			printf("%lld\n", b);
			return 0;
		}
	}
	printf("%d\n", -1);
	return 0;
}

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

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

typedef long long ll;
typedef long double ld;

using namespace std;

const int maxn = 100*1000+10;
int a[maxn], n, l;

int main()
{
    cin >> n >> l;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    for (int i = 0; i < n - 1; i++)
    {
        if (a[i] + a[i + 1] >= l)
        {
            cout << "Possible";
            for (int j = 0; j < i; j++)
                cout << endl << j + 1;
            for (int j = n - 2; j >= i; j--)
                cout << endl << j + 1;
            return 0;
        }
    }
    cout << "Impossible";
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n =sc.nextInt();
		int[] a = new int[n+2];
		
		for(int i=1;i<=n;i++){
			String s = sc.next();
			int x = sc.nextInt();
			if(s.equals("(")){
				a[i]=x;
			}
			else{
				a[i]=-x;
			}
		}
//		int left=0,right=a.length-1;
//		for(int i=1;i<=n;i++){
//			if(a[i]>0&&a[i+1]<0){
//				int c1=0,c2=0;
//				for(int j = i;j>0;j--){
//					c1+=a[j];
//					a[j]=0;
//				}
//				int j=0;
//				for(j=i+1;j<=n;j++){
//					if(a[j]>=0)break;
//					c2-=a[j];
//					a[j]=0;
//				}
//				if(c1==c2){
//					i=j-1;
//				}
//				else{
//					System.out.println("NO");return;
//				}
//			}
//		}
		int cnt=0;
		for(int i=1;i<=n;i++){
			cnt+=a[i];
			if(cnt<0){
				System.out.println("NO");
				return;
			}
		}
		/*
		System.out.println("OK");
		while(left<right){
			if(a[left]>0&&a[right]>0||a[left]<0&&a[right]<0){
				System.out.println("NO");return;
			}
			if(a[left]<0||a[right]>0){
				System.out.println("NO");return;
			}
			if(a[left]>0&&a[right]<0){
				int r = -a[right];
				if(a[left]>r){
					a[left]-=r;
					right--;
				}
				else if(a[left]<r){
					a[right]+=a[right];
					left++;
				}
				else{
					left++;
					right--;
				}
			}


		}
		*/
//		for(int i=0;i<n+2;i++){
//			System.out.println(a[i]);
//			if(a[i]!=0){
//				System.out.println("NO");
//				return;
//			}
//		}
		if(cnt==0){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}

}

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

int main() {
	int N, M;
	cin >> N >> M;
	int cycle = M * 1900 + (N - M) * 100;
	double answer = 0;
	double diff = 0;
	double poss = pow(0.5, M);
	for (int i = 1; i < 10000000; i++) {
		diff = i * cycle * pow(1 - poss, i - 1) * poss;
		answer += diff;
	}
	cout << round(answer) << endl;
}

Measured memory_bytes: 384
def month?(str)
  n = str.to_i
  return false if n <= 0
  return false if n > 12
  true
end

def year?(str)
  true
end

def yymm?(a, b)
  year?(a) && month?(b)
end

def mmyy?(a, b)
  yymm?(b, a)
end

s = gets.chomp

a, b = s[0, 2], s[2, 2]

if yymm?(a, b) && mmyy?(a, b)
  puts 'AMBIGUOUS'
elsif yymm?(a, b)
  puts 'YYMM'
elsif mmyy?(a, b)
  puts 'MMYY'
else
  puts 'NA'
end


Measured memory_bytes: 3836
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b)
		swap(a,b);
	if(a==1&&b==2)
		cout<<3;
	else if(a==1&&b==3)
		cout<<2;
	else
		cout<<1;
	return 0;
}

Measured memory_bytes: 256