akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18



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

	cout << (n - 1+(k-1)-1) / (k - 1)  << endl;

	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let N: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };

    const INF: i64 = 1_000_000_000_000_000;
    let ans = (1..(1_000_000 + 1)).map(|i| if N % i == 0 { i + N / i - 2} else { INF }).min().unwrap();

    println!("{}", ans);
}

Measured memory_bytes: 4476
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

//nCr mod m
#define MOD 998244353
#define M 2200000
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}


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

	int a;
	cin>>a;
	int t=100,w=0;
	while(1){
		w++;
		t=t*1.01;
		if(t>=a){
			cout<<w<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3656
#include <stdio.h>

/*

2 ????????°?????????

2????????´??° x, y ?????????????????????????????????????°?????????????????????????????????°?????????????????????????????????

?????????????????????????????\?????????????????????????????????????????????????????????????????????????????¨?????¨?????????????????????

Input
??\???????????°????????????????????????????§?????????????????????????????????????????????????????????§???????????????2????????´??° x, y ?????????1??????????§?????????????????????????

x ??¨ y ?????¨?????? 0 ?????¨?????\?????????????????????????????????????????????????????????????????????????????£????????????????????????

Output
??????????????????????????¨??????x ??¨ y ????°???????????????????????????????1??????????????????????????????x ??¨ y ????????????1?????????????????\??????????????????

*/

int main( void )
{
	int x, y;

	for ( ; ; ) {
		scanf( "%d %d", &x, &y  );
		
		if ( ( x == 0 ) && ( y == 0) ) {
			break;
		}
		
		if ( x < y ) {
			printf( "%d %d\n", x, y );
		}
		else {
			printf( "%d %d\n", y, x );
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

#define ll long long int

int main(){
  ll N;
  cin >> N;
  ll min=2*10E5;
  ll count=0;
  for(ll i=0;i<N;i++){
    ll p;
    cin >> p ; 
    if(p<=min){
      count++;
      min=p;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;

// const ll n_max = 100010;
// ll fact[n_max];

// ll npn(ll x)
// {
//     if (x==1) return fact[0];
//     if (fact[x-1]!=-1) return fact[x-1];

//     fact[x-1] = x * npn(x-2);
//     fact[x-1] %= MOD;
//     return fact[x-1];
// }


ll fact(ll x)
{
    if (x==1) return 1;
    if (x>99900)
    {
        cout << x << endl;
    }
    return (x * fact(x-1))%MOD;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m;cin>>n>>m;
    ll ary[100010];
    ary[0] = 1;
    REP(i,1,100010)
    {
        ary[i] = ary[i-1] * (i+1);
        ary[i] %= MOD;
    }

    if (abs(n-m)>1)
    {
        cout << 0 << endl;
    }
    else if (n == m)
    {
        // cout << (2 * (npn(n) * npn(m))%MOD) % MOD << endl;
        cout << (2 * ary[n-1] * ary[m-1]) % MOD << endl;
    }
    else
    {
        cout << (ary[n-1] * ary[m-1])%MOD << endl;
    }
}




Measured memory_bytes: 1024
n = gets.to_i
u = []
n.times do
    u.push(gets.chomp)
end

lock = true

m = gets.to_i
m.times do
    s = gets.chomp
    if u.count(s) == 0
        puts "Unknown #{s}"
    elsif lock
        puts "Opened by #{s}"
        lock = false
    else
        puts "Closed by #{s}"
        lock = true
    end
end


Measured memory_bytes: 8900
n=int(input())
a=list(input().split(" "))
a=list(map(int,a))
a.sort(reverse=True)
alic=[]
bob=[]
for i in range(0,n):
    if i==0 or i%2==0:
        alic.append(a[i])
    else:
        bob.append(a[i])
print(sum(alic)-sum(bob))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld\n",x)
#define print2(x) printf("%lld ",x)
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok = true, flag = false;
ll dx[5] = { 1,-1,0,0,0 }, dy[5] = { 0,0,1,-1,0 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 333333


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

  FOR(i, 1, sqrt(m) + 1) {
	if (m%i !=0) continue;
	if (m / i >= n) ans = max(ans, i);
	if (i >= n) ans = max(ans, m / i);
  }
  cout << ans << endl;


  return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	string s, t; cin >> s >> t;
	vector<vector<int>> vec(26);
	rep(i, 0, s.size() - 1)
	{
		vec[s[i] - 'a'].push_back(i + 1);
	}
	ll pos = 0;
	ll cnt = 0;
	for (char x : t)
	{
		if (vec[x - 'a'].size() == 0)
		{
			cout << -1 << endl;
			return 0;
		}

		auto it = upper_bound(all(vec[x - 'a']), pos);
		if (it - vec[x - 'a'].end() == 0)
		{
			++cnt;
			pos = vec[x - 'a'][0];
		}
		else
		{
			pos = *it;
		}
	}
	ll ans = cnt * s.size() + pos;
	cout << ans << endl;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int vec[26] = {0};
  char c;
  bool ans = false;
  while (cin >> c) ++(vec[c - 'a']);
  for (int i = 0; i < 26; i++) {
    if (vec[i] > 1) ans = true;
  }
  if (ans) cout << "no" << '\n';
  else cout << "yes" << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

// union-find tree with size(struct)
struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
	vector<int> size; // 連結成分のサイズ

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n);
		rank.resize(n);
		size.resize(n);
        for (int i = 0; i < n; ++i){
			par[i] = i;
			rank[i] = 0;
			size[i] = 1;
		}
    }

    int find(int x) {
        if (par[x] == x)  return x;

        int r = find(par[x]);
        return par[x] = r;
    }

    bool issame(int x, int y) {
        return find(x) == find(y);
    }

    bool unite(int x, int y) {
	    x = find(x);
		y = find(y);
	    if (x == y) return false;

	    if (rank[x] < rank[y]) swap(x, y);
	    if (rank[x] == rank[y]) ++rank[x];
	    par[y] = x;
		size[x] += size[y];
	    return true;
    }

	int getSize(int x){
		return size[find(x)];
	}

	int getRank(int x){
		return rank[find(x)];
	}
};

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

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

	vector<int> p(n);
	rep(i, n) cin >> p[i];

	UnionFind uf(n-k+1);

	multiset<int> ms;
	rep(i, k) ms.insert(p[i]);

	for(int i = 0; i < n - k; i++){
		bool ok = *ms.begin() == p[i];
		ms.erase(p[i]);
		ms.insert(p[i + k]);

		auto itr = ms.end();
		itr--;
		if(ok && (*itr == p[i + k])){
            // cout << "unite:" << i << "," << i+1 << endl;
			uf.unite(i, i + 1);
		}
	}

	vector<int> a(n-1, 0);
	rep(i, n-1){
		if(p[i] < p[i+1]) a[i]++;
	}

	vector<int> b(n-k+1, 0);
	rep(i, k - 1){
		b[0] += a[i];
	}

	vector<int> v;
	if(b[0] == k - 1) v.push_back(0);

	for(int i = 1; i < n - k + 1; i++){
		b[i] = b[i-1] - a[i-1] + a[i+k-2];
		if(b[i] == k - 1) v.push_back(i);
	}

    // cout << "a:";
    // rep(i, n-1) cout << a[i] << (i == n-2 ? "\n" : " ");
    //
    // cout << "b:";
    // rep(i, n-k+1) cout << b[i] << (i == n-k ? "\n" : " ");

	int m = v.size();

    // if(m > 0) {
    //     cout << "initial order:";
    //     rep(i, m) cout << v[i] << (i == m - 1 ? "\n" : " ");
    // }

	rep(i, m-1){
		if(!uf.issame(v[0], v[i+1])){
			uf.unite(v[0], v[i+1]);
		}
	}

	set<int> st;
	rep(i, n-k+1){
		if(st.count(uf.find(i)) == 0){
			st.insert(i);
		}
	}

	cout << st.size() << endl;
}


Measured memory_bytes: 14336
n,s = int(input()),[]
for i in range(n):
	s.append(input())
m,t = int(input()),[]
for i in range(m):
	t.append(input())
ans = []
for i in range(n):
	ans.append(0)
	for j in range(n):
		if s[i] == s[j]:
			ans[i] += 1
	for j in range(m):
		if s[i] == t[j]:
			ans[i] -= 1
ans.append(0)
print(max(ans))


Measured memory_bytes: 3064
N,M=map(int,input().split())
L=[list(map(int,input().split())) for i in range(M)]
for i in range(M):
    L[i].append(i)
L.sort(key=lambda x:x[1])
L.sort(key=lambda x:x[0])
city_num=1#
#12 to 1
#32 to 2
inside_num=1
for i in range(M):
    while L[i][0]!=city_num:
        city_num+=1
        inside_num=1
    L[i][1]=inside_num
    inside_num+=1
#print(L)
L.sort(key=lambda x:x[2])
for l in L:
    print("{:0=6}{:0=6}".format(l[0],l[1]))#0 padding


Measured memory_bytes: 32280
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

class Counting {
	unsigned long long p, n;
	vector<long long> invMemo, facMemo, facInvMemo;
public:
	Counting(unsigned long long nn, unsigned long long np) {
		p = np;
		n = nn;
		invMemo.resize(n + 1);
		facMemo.resize(n + 1);
		facInvMemo.resize(n + 1);
		facMemo[0] = 1;
		facMemo[1] = 1;
		facInvMemo[0] = 1;
		facInvMemo[1] = 1;
		invMemo[0] = 0;
		invMemo[1] = 1;
		for (unsigned long long i = 2; i <= n; i++) {
			invMemo[i] = p - (p / i)*invMemo[p%i] % p;
			facMemo[i] = (facMemo[i - 1] * i) % p;
			facInvMemo[i] = (facInvMemo[i - 1] * invMemo[i]) % p;
		}
	}
	unsigned long long fac(unsigned long long k) {
		return facMemo[k];
	}
	unsigned long long facInv(unsigned long long k) {
		return facInvMemo[k];
	}
	unsigned long long choose(unsigned long long n, unsigned long long k) {
		if (!(0 <= k && k <= n))
			return 0;
		return (((facMemo[n] * facInvMemo[k]) % p)*facMemo[n - k]) % p;
	}
	unsigned long long divide(unsigned long long a, unsigned long long b) {
		return (a * invMemo[b]) % p;
	}
	unsigned long long mod(unsigned long long a) {
		a %= p;
		if (a < 0) a += p;
		return a;
	}
	unsigned long long power(unsigned long long a, unsigned long long e) {
		unsigned long long ans = 1;
		for (; e > 0; e /= 2) {
			if (e % 2 != 0)
				ans = ans * a % p;
			a = a*a%p;
		}
		return ans;
	}
};

string s;
int n, amari, ans = 0;
vector<int> g, p;

int main() {
	cin >> s;
	n = s.size();
	g.resize(n);
	p.resize(n);
	int sum_g = 0, sum_p = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'g')
			sum_g++;
		else
			sum_p++;
		g[i] = sum_g;
		p[i] = sum_p;
	}
	amari = g[n - 1] - p[n - 1];
	for (int i = 1; amari > 1; i++) {
		amari = min(amari, g[n - i] - p[n - i]);
		if (s[n - i] == 'g') {
			ans++;
			amari -= 2;
		}
	}
	cout << ans << endl;
//	cin >> n;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
ll mod=1e9+7;
void add(ll &x,ll y){
	x+=y;
	x%=mod;
}
ll dp[5001][5001];
int main(){
	int N,K;
	string s;
	cin>>N>>s;
	K=s.size();
	dp[0][0]=1;
	rep(i,N) rep(j,i+1) if(dp[i][j]){
		add(dp[i+1][j+1],dp[i][j]*2);
		add(dp[i+1][max(j-1,0)],dp[i][j]);
	}
	ll i2=(mod+1)/2;
	ll ans=dp[N][K];
	rep(i,K) ans=ans*i2%mod;
	cout<<ans<<endl;
}


Measured memory_bytes: 193792
function main(input){
  const args = input.split(' ');
  const k = parseInt(args[0],10);
  const x = parseInt(args[1],10);
  
  if(500 * k >= x){
    console.log('Yes');

  }
  else{
    console.log('No');

  }
}

main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
const int N = 3005;
int n,m;
string a,b;
int dp[N][N];
int solve (int i,int j){
if(i==n||j==m)return 0;
int &ret=dp[i][j];
if(~ret)return ret;
if(a[i]==b[j])ret=1+solve(i+1,j+1);
else ret=max(solve(i,j+1),solve(i+1,j));
return ret;
}
string ans="";
void build(int i,int j){
if(i==n||j==m)return;
if(a[i]==b[j]){
    ans+=a[i];
    build(i+1,j+1);
}
else if(solve(i,j)==solve(i+1,j)){
    build(i+1,j);
}
else {
    build(i,j+1);
}

}
int main(){
    IO;
    memset(dp,-1,sizeof(dp));
    cin>>a>>b;
    n=a.size();
    m=b.size();
    solve(0,0);
    build(0,0);
    cout<<ans;
}


Measured memory_bytes: 35840
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int ac=0,wa=0,tle=0,re=0;
  int n;
  cin>>n;
  while(n)
  {
    string s;
    cin>>s;
    if(s=="AC")ac++;
    else if(s=="WA")wa++;
    else if(s=="TLE")tle++;
    else re++;
    n--;
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3640
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


ll fac[MAX], finv[MAX], inv[MAX];

void COMinit(ll MOD) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k, ll MOD){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    COMinit(mod);
    ull n,a,b,k;
    ll ans=0;
    cin>>n>>a>>b>>k;
    rep(i,n+1){
        if((k-i*a)%b!=0) continue;
        ll j=(k-i*a)/b;
        ans+=COM(n,i,mod)*COM(n,j,mod)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 12160
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

char m[100][100];
int n[100][100];

int main() {
	int a,b;
	cin>>a>>b;
	int i,j;
	for(i=0;i<a;i++){
		for(j=0;j<b;j++){
			cin>>m[i][j];
			m[i][j]-='0';
		}
	}
	for(i=1;i<a;i++){
		n[i][0]=n[i-1][0]+m[i][0];
	}
	for(j=1;j<b;j++){
		n[0][j]=n[0][j-1]+m[0][j];
	}
	for(i=1;i<a;i++){
		for(j=1;j<b;j++){
			n[i][j]=min(n[i-1][j],n[i][j-1])+m[i][j];
		}
	}
	cout<<n[a-1][b-1]<<endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
 
using namespace std;

int main(){

int a,b;

cin>>a>>b;

if(a<b)cout<<"a"<<" < "<<"b"<<endl;
else if(a>b)cout<<"a"<<" > "<<"b"<<endl;
else cout<<"a"<<" == "<<"b"<<endl;

}


Measured memory_bytes: 3032
#入力
N = int(input())
D,X = map(int, input().split())
A = []
for _ in range(N):
    A.append(int(input()))
#処理
ans = 0
for i in A:
    a = 1
    while a <= D:
        ans += 1
        a += i
print(ans + X)


Measured memory_bytes: 2940
N=int(input())
H=list(map(int,input().split()))


M=0
K=[]
if N==1:
    print(0)
elif N==2:
    if H[0]>=H[1]:
        print(1)
    else:
        print(0)
else:
    HH=[H[1]-H[0]]
    for i in range(1,N-1):
        HH.append(H[i+1]-H[i])
    for i in range(len(HH)):
        if HH[i]<=0:
            M+=1
        else:
            K.append(M)
            M=0
    K.append(M)
    print(max(K))

Measured memory_bytes: 14252
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int mod = 1000000007;

int main(){
    ll p,q,r;
    cin>>p>>q>>r;
    ll k=min(p+q,min(q+r,r+p));
    cout<<k<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    string s,t;
    cin >> s;
    cin >> t;

    bool frag = false;

    for(int i = 0; i < s.size(); i++){
        if(s.substr(0,s.size()-i) == t.substr(i,s.size()-i)){
            if(s.substr(s.size()-i,i) == t.substr(0,i)){
                frag = true;
            }
        }
    }

    cout << (frag?"Yes":"No") << endl;
    
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int a = 0, b = 0, c = 0;
    rep(i,s.length()){
        if(s[i] == 'a') a++;
        if(s[i] == 'b') b++;
        if(s[i] == 'c') c++;        
    }
    if(abs(a-b) <= 1 && abs(b-c) <= 1 && abs(c-a) <= 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;

ll N;
string s;
int a,b,c;
int main(){
    cin>>a;

    cout<<3*a*a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i, j, N, cont = 0, ans = 0;

	scanf("%d", &N);

	for (i = 1; i <= N; i += 2) {
		cont = 0;
		for (j = i; j > 0; j--) {
			if (i % j == 0) cont++;
		}
		if (cont == 8) ans++;
	}

	printf("%d\n", ans);

	return 0;
}

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

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

  string s,t;
  cin >> s >> t;

  int diff = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    if(s[i] != t[i]) diff++;
  }
  cout << diff << '\n';
}


Measured memory_bytes: 3788
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    a, b, c = Scanner.map_int()
    d = c - a - b
    if d > 0 and 4 * a * b < d * d:
        print('Yes')
    else:
        print('No')


def main():
    # sys.stdin = open("sample.txt")
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 5120
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>

using namespace std;

#define Int int64_t

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}




int main() {
	int n, m, c; cin >> n >> m >> c;
	vector<vector<int> > datas(n, vector<int>(m));
	vector<int> b(m);

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

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> datas[i][j];
		}
	}

	int count = 0, inp;

	for (int i = 0; i < n; i++) {
		inp = 0;
		for (int j = 0; j < m; j++) {
			inp += b[j] * datas[i][j];
		}
		if (inp + c > 0) count++;
	}


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

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

int main(){
    int N, K;
    cin >> N >> K;
    int value = 1;

    rep(i,N){
        if (value * 2 < value + K){
            value *= 2;
        } else {
            value += K;
        }
    }
    cout << value << endl;
}

Measured memory_bytes: 256
import sys
n,k=map(int,input().split())
w=list(map(int,sys.stdin.readlines()))
def f():
 i=0
 for _ in[0]*k:
  s=0
  while s+w[i]<=m:
   s+=w[i];i+=1
   if i==n:return n
 return i
l,r=max(w),sum(w)
while l<r:
 m=(l+r)//2
 if f()>=n:r=m
 else:l=m+1
print(r)


Measured memory_bytes: 15828
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, a: usize);
    let b: usize = it.next().unwrap().replace(".", "").parse().unwrap();
    let ret = a * b / 100;
    println!("{}", ret);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2144
#include <iostream>
#include <map>

using namespace std;

int main()
{
    map<string, int> dic = {};
    int n, m;
    string s, t;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        if (dic[s] > 0) ++dic[s];
        else dic[s] = 1;
    }
    cin >> m;
    for (int i = 0; i < m; ++i) {
        cin >> t;
        if (dic[t] > 0) --dic[t];
    }

    int ans = 0;
    for (auto& p : dic) {
        if (p.second > ans) ans = p.second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//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<ll>v1,v2;
vector<p>x1,x2;
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    v1.pb(a);
    x1.pb({a,i});
}
//sort(arr.begin(),arr.end());
for(ll i=0;i<n;i++)
{
    ll a;
    cin>>a;
    v2.pb(a);
    x2.pb({a,i});
}

sort(x1.begin(),x1.end());
sort(x2.begin(),x2.end());
bool flag=true;
vector<p>arr(n);
for(ll i=0;i<n;i++)
{
    if(x1[i].fi>x2[i].fi)
    {
        flag=false;
        break;
    }
    arr[x2[i].se]=x1[i];
    //s.insert({x1[i],x2[i]});
}

if(!flag)
{
    cout<<"No"<<endl;
    return 0;
}

 flag=false;
for(ll i=1;i<n;i++)
{
    if(x1[i].fi<=x2[i-1].first)
    {
        flag=true;
        break;
    }
}
if(flag)
{
    cout<<"Yes"<<endl;
    return 0;
}
ll ans=0;
vector<bool>visited(n+1,false);
for(ll i=0;i<n;i++)
{
    if(visited[i]==true||arr[i].se==i)
    {
        continue;
    }
    ll c=0;
    ll j=i;
    while(!visited[j])
    {
        visited[j]=true;
        j=arr[j].se;
        c++;
    }
    if(c>0)
    {
        ans+=(c-1);
    }
}
if(ans<=n-2)
{
    cout<<"Yes"<<endl;
}else
{
    cout<<"No"<<endl;
}





return 0;
}


Measured memory_bytes: 8296
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
long long int a[300000];
int main(){
    int N;
    cin>>N;
    for(int i=0;i<N*3;i++)cin>>a[i];
    long long int ans=0;
    sort(a,a+N*3);
    for(int i=N*3-2;N<=i;i-=2){
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}


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

from collections import deque

N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

que = deque([0])    # 添え字0からアクセス開始
color[0] = 0    # 添え字0をcolor0と置く
while len(que) > 0:
    idx = que.popleft()
    visit[idx] = True
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
            que.append(i)
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
            que.append(i)

for c in color:
    print(c)


Measured memory_bytes: 39956
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    vector<ll> lunlun{
        1,2,3,4,5,6,7,8,9
    };
    queue<ll> q;
    q.push(1);
    q.push(2);
    q.push(3);
    q.push(4);
    q.push(5);
    q.push(6);
    q.push(7);
    q.push(8);
    q.push(9);
    while(lunlun.size() < k)
    {
        ll x = q.front();
        q.pop();
        if(x%10 != 0)
        {
            q.push(10*x + x%10 - 1);
            lunlun.push_back(10*x + x%10 - 1);
        }
        q.push(10*x + x%10);
        lunlun.push_back(10*x + x%10);
        if(x%10 != 9)
        {
            q.push(10*x + x%10 + 1);
            lunlun.push_back(10*x + x%10 + 1);
        }
    }
    // for(auto num : lunlun) cout << num << '\n';
    cout << lunlun.at(k-1) << '\n';
    return 0;
}

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

map<ll,ll> factorization(ll n) {
  map<ll,ll> res;
  for (ll i=2; i*i<=n; i++) {
    while (n%i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n!=1) res[n]++;
  return res;
}

int main() {
  ll n;
  cin >> n;
  map<ll,ll> mp=factorization(n);
  ll ans = 0;
  for (auto x : mp) {
    ll i = 1;
    while (x.second >= i) {
      ans++;
      x.second -= i;
      i++;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3632
n,m,l=map(int, input().split())

A=[]
B=[]
for i in range(n):
    A.append(list(map(int, input().split())))

for j in range(m):
    B.append(list(map(int, input().split())))
    
C=[]
for i in range(n):
    tmp_line=[]
    for j in range(l):
        tmp=0
        for k in range(m):
            tmp=tmp+A[i][k]*B[k][j]
        tmp_line.append(tmp)
    C.append(tmp_line)
    


for i in C:
    print(*i)


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

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

    int a, b, c;
    cin >> a >> b >> c;

    if(a == b + c or b == c + a or c == a + b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import math

n, d = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for i in range(n):
	for j in range(i+1, n):
		dist = 0
		for k in range(d):
			dist += math.pow(p[i][k]-p[j][k], 2)
		dist = math.sqrt(dist)
		if dist.is_integer():
			ans += 1

print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<vector>

using namespace std;

int main() {
	int n, d;
	cin >> n >> d;
	vector<vector<int>> x(n, vector<int>(d));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}
	int count = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int sum = 0;
			for (int k = 0; k < d; k++) {
				int  sq = abs(x[j][k] - x[i][k]);
				sum += sq*sq;
			}
			bool ans = false;
			for (int l = 0; l <= sum; l++) {
				if (sum == l*l) {
					ans = true;
				}
			}
			if (ans)count++;
		}
	}
	cout << count << endl;

	return 0;
}

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

const int mod = 1000000007;

int main(){
    char s;
    cin >> s;
    char ans = s + 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>

using namespace std;

int n, k;
vector<int> arr[2100];
int ans = 2100;
int lim1, lim2;
int cnt1, cnt2;

void go2(int id, int par, int dep) {
    if (dep > lim1) cnt1++;
    if (dep > lim2) cnt2++;
    for (int nid : arr[id]) {
        if (nid != par) {
            go2(nid, id, dep + 1);
        }
    }
}

void go(int id) {
    int myans = 0;
    int minred = 0;
    for (int nid : arr[id]) {
        cnt1 = cnt2 = 0;
        go2(nid, id, 1);
        myans += cnt1;
        minred = min(minred, cnt2 - cnt1);
    }
    ans = min(ans, myans + minred);
}

int main() {
    scanf("%d%d", &n, &k);
    for (int i = 1; i < n; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        a--; b--;
        arr[a].push_back(b);
        arr[b].push_back(a);
    }
    lim1 = k / 2;
    lim2 = (k + 1) / 2;
    for (int i = 0; i < n; i++) go(i);
    printf("%d\n", ans);
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ld dp[3010][3010];

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin>>s;
  
  ll ans = 0;
  REP(i,4){
    if(s[i]=='2')
      ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
f=[[int(i) for i in input().split()] for j in range(n)]
p=[[int(i) for i in input().split()] for j in range(n)]

ans=float('-inf')
for i in range(1,2**10):
    check_sum=0
    for j in range(n):
        check=0
        for l in range(10):
            if i>>l &f[j][l]:
                check+=1
        check_sum+=p[j][check]
    ans=max(ans,check_sum)
print(ans)


Measured memory_bytes: 3064
from sys import setrecursionlimit
setrecursionlimit(10 ** 6)

mod = 10 ** 9 + 7

N, *XY = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for x, y in zip(*[iter(XY)] * 2):
    E[x].append(y)
    E[y].append(x)

def dfs(cur, par):
    w, b = 1, 1
    for nxt in E[cur]:
        if nxt == par:
            continue
        ww, bb = dfs(nxt, cur)
        w = (w * (ww + bb)) % mod
        b = (b * ww) % mod
    return (w, b)

print(sum(dfs(1, -1)) % mod)

Measured memory_bytes: 101336
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  if(a >= b && a >= c)System.out.println(a*10 + b + c);
  else if(b >= a && b >= c)System.out.println(b*10 + a + c);
  else if(c >= b && c >= a)System.out.println(c*10 + b + a);
}}

Measured memory_bytes: 22608
H1,M1,H2,M2,K=input().split()
H1=int(H1)
M1=int(M1)
H2=int(H2)
M2=int(M2)
K=int(K)
H=(H2-H1)*60
M=M2-M1
G=H+M
S=G-K
print(S)



Measured memory_bytes: 9180
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<algorithm>
#include<iterator>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#define lli long long int
#define mp make_pair
#define ULTRA_INSTINCT ios_base::sync_with_stdio(false); cin.tie(0)
#define PI  3.141592653589793
#define fo(i,n) for(lli i=0;i<(n);i++)
#define FO(i,x,n) for(lli i=(x);i<(n);i++)
#define pb push_back
#define FI first
#define SE second
#define vi vector<lli>
#define pi pair<lli,lli>
#define vii vector<pi >
#define Endl endl
#define ITA 200005
#define ROH 100005
using namespace std;
lli mod = 1e9 +7,test; 
lli max(lli a,lli b){return a>b?a:b;}
lli min(lli a,lli b){return a>b?b:a;}

lli gcd(lli a, lli b) { 
   if (b == 0) return a; 
   return gcd(b, a % b);  
} 

lli n,k;
vi a(102);

vector<vi > dp;


void solve(){
    cin>>n>>k;
    fo(i,n){
        cin>>a[i+1];
    }    
    dp.resize(n+1 , vi(k+1));
    fo(i,k+1){
        dp[0][i] = 0;
    }
    dp[0][0] = 1;
    vi sum(k+1);
    for(int i = 1;i<=n;i++){
       sum[0]=dp[i-1][0];
        for(int j=1;j<=k;j++){
            sum[j]=(sum[j-1]+dp[i-1][j])%mod;  ///Calculate the prefix sums for i-1
        }
        for(int j=0;j<=k;j++){
            int tr=sum[j];  ///Sum of dp[i-1][0...j]
            int unreachable=j-a[i]-1;  ///We need to subtract the sum of the first "unreachable" elements (dp[i-1][0...unreachable])
            if(unreachable>=0){
                tr=(tr-sum[unreachable]+mod)%mod;  ///Add mod to make sure that "tr-sums[unreachable]" is not negative.
            }
            dp[i][j]=tr;
    }
    }
    cout<<dp[n][k]<<endl;
}

int main(){
    ULTRA_INSTINCT;
    lli t =1;
    // cin>>t;
    fo(i,t){
        solve();
    }
    return 0;

}

Measured memory_bytes: 80256
def main():
    buf = input()
    n = int(buf)

    best = 0
    best_num = 1
    for i in range(n):
        k = i + 1
        c = 0
        while k % 2 == 0:
            k //= 2
            c += 1
        if c > best:
            best = c
            best_num = i + 1

    print(best_num)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
int main()	{
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n){cin>>a[i];}
  int al=0,bo=0;
  sort(a.rbegin(),a.rend());
  rep(i,n){
    if(i%2==0)
      al+=a[i];
    else
      bo+=a[i];
  }
  int ans=al-bo;
  cout<<ans<<endl;
}

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

struct Card {
	char moji;
	int value;
};


void print(struct Card A[], int N) {

	int i;
	for (i = 0; i < N; i++) {
		if (i > 0) cout << " ";
		cout << A[i].moji << A[i].value;
	}

	cout << endl;

}


void Bubble_Sort(struct Card A[], int N) {

	int i, j;

	for (i = 0; i < N; i++) {
		for (j = N - 1; j >= i; j--) {
			if (A[j].value < A[j-1].value) {
				Card tmp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = tmp;
			}
		}
	}
}

void Selection_Sort(struct Card A[], int N) {

	int i, j;
	int min;

	for (i = 0; i < N; i++) {
		min = i;
		for (j = i; j < N; j++) {
			if (A[j].value < A[min].value) {
				min = j;
			}
		}

		Card tmp = A[i];
		A[i]= A[min];
		A[min] = tmp;
	}

}


bool Stable(struct Card C1[], struct Card C2[], int N) {
	int i;
	for (i = 0; i < N; i++) {
		if (C1[i].moji != C2[i].moji) return 0;
	}

	return 1;
}

int main() {


	struct Card C1[100],C2[100];
	int N;
	int i;

	cin >> N;

	for (i = 0; i < N; i++) {
		cin >> C1[i].moji >> C1[i].value;
	}

	for (i = 0; i < N; i++) {
		C2[i] = C1[i];
	}

	Bubble_Sort(C1, N);
	Selection_Sort(C2, N);

	print(C1, N);
	cout << "Stable" << endl;
	print(C2, N);
		
	if (Stable(C1, C2, N)) {
		cout << "Stable" << endl;
	}
	else {
		cout << "Not stable" << endl;
	}


	return 0;

}

Measured memory_bytes: 1164
#include <iostream>
using namespace std;
 
#define ll long long
#define endl "\n"
 
string s1[55],s2[55];
int main()
{
  int  n,m;
  cin>>n>>m;
  for(int i=0;i<n;++i)
   cin>>s1[i];
  for(int i=0;i<m;++i)
   cin>>s2[i];
      for(int c1=0;c1<n-m+1;++c1){
       for(int c2=0;c2<n-m+1;++c2){
        bool f=true;
         for(int i=0;i<m;++i){
          for(int j=0;j<m;++j){
              if(s1[i+c1][j+c2]!=s2[i][j]){
                f=false;
                break;
              }
          if(f==false)
                break;
         }
      }
      if(f){
        cout<<"Yes"<<endl;
        return 0;
      }
      }
    }
      cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var md = IO.RSInt;
            var md2 = IO.RSInt;

            if (md[0] != md2[0]) WriteLine(1);
            else WriteLine(0);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(var,start,end) for(int var=start; var<end; var++)
#define repr(var,start,end) for(int var=start; var>=end; var--)
#define repi(var,start,end) for(int var=start; var<=end; var++)
#define debg(var) cerr<<#var<<" : "<<var<<" "
#define pb push_back
#define mp make_pair

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

void solve() {
    int n,d;
    cin>>n>>d;
    int ans = 0;
    rep(i,0,n) {
        ll x,y;
        cin>>x>>y;
        if(sqrt(x*x+y*y)<=d)
            ans++;
    }
    cout<<ans;
}

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

Measured memory_bytes: 3664
n = int(input())
day, x = map(int, input().split())
a = [int(input()) for i in range(n)]

choco = 0
for diff in a:
    n = 0
    an = 0
    while 1:
        an = 1 + diff * n
        if an > day:
            break
        choco += 1
        n += 1
print(choco + x)

Measured memory_bytes: 3060
#include <stdio.h>

int main(void) {
  int a, b, k, i;
  scanf("%d%d%d", &a, &b, &k);
  bool s = true;
  for(i = 0; i < k; ++i) {
    if(s) a /= 2, b += a;
    else b /= 2, a += b;
    s = !s;
  }
  printf("%d %d", a, b);
  return 0;
}

Measured memory_bytes: 128