akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
int x,y,z,k,a[1010],b[1010],c[1010];
vector<int> vec;
bool func(int v){
	int cnt=0;
	rep(i,x*y){
		rep(j,z){
			if(v<=vec[i]+c[j])cnt++;
			else break;
			if(cnt>=k)return false;
		}
	}
	if(cnt<k)return true;
	return false;
}
signed main(){
	cin>>x>>y>>z>>k;
	rep(i,x)cin>>a[i];
	rep(i,y)cin>>b[i];
	rep(i,z)cin>>c[i];
	vec.resize(1000000);
	rep(i,x){
		rep(j,y)vec.push_back(a[i]+b[j]);
	}
	sort(vec.begin(),vec.end(),greater<int>());
	sort(c,c+z,greater<int>());
	int mi=0,ma=30000000000;
	while(ma-mi>1){
		int md=(mi+ma)/2;
		if(func(md))ma=md;
		else mi=md;
	}
	vector<int> ans;
	ans.resize(3000);
	rep(i,x*y){
		rep(j,z){
			if(mi<=vec[i]+c[j])ans.push_back(vec[i]+c[j]);
			else break;
		}
	}
	sort(ans.begin(),ans.end(),greater<int>());
	rep(i,k)cout<<ans[i]<<endl;
	ggr;
}

Measured memory_bytes: 125776
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int MAXN=2e5+10;
void file(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
int read()
{
	int f=1,a=0;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-'){
			f=-f;
		}
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		a=a*10+ch-'0';
		ch=getchar();
	}
	return a*f;
}
struct node{
	int id,num;
}sta[MAXN];
int n,r[MAXN],l[MAXN],a[MAXN],top,ans;
signed main()
{
//  file("");
	n=read();
	for(int i=1;i<=n;++i){
		r[i]=n+1,l[i]=0;
	}
	for(int i=1;i<=n;i++){
		a[i]=read();
		if(!top){
			sta[++top]=(node){i,a[i]};
			l[i]=0;
		}else{
			while(sta[top].num>a[i]){
				r[sta[top--].id]=i;
			}
			l[i]=sta[top].id;
			sta[++top]=(node){i,a[i]};
		} 
	}
	for(int i=1;i<=n;++i){
		ans+=(r[i]-i)*(i-l[i])*a[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 8064
#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;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster
	ll n;
	cin>>n;
	ll ans=(n-1)*2-1;
	int i;
	for(i=2;i<=sqrt(n);i++)
	{
		ll div;
		div=n/i;
		if(div>=i)
		{
			//cout<<i<<" "<<div<<" "<<ans<<nl;
			if(n%i==0)
			{
				ans+=(div-i)*2-1;
				if(div==i)ans++;
			}
			else ans+=(div+1-i)*2-1;
		}
	}
	cout<<ans<<nl;
	return 0;
}


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

int main()
{
    int k,a,b;
    cin >> k;
    cin >> a >> b;
    int largest = (b/k) * k;
    if(a <= largest){
        puts("OK");
    }
    else {
        puts("NG");
    }
    return 0;
}


Measured memory_bytes: 3608
#include "bits/stdc++.h"

using namespace std;

#ifdef LOCAL
#include "debug.hpp"
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n ,a ,b;
  cin >> n >> a >> b;
  if (a < b) swap(a,b);
  if ((a-b-1)&1) {
    cout << (a-b)/2;
  } else {
    long long ans =  min(n - a, b - 1) + 1;
    ans += (a-b-1)/2;
    cout << ans;
  }
  return 0;
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    
    if(max({a,b,c})==a+b+c-max({a,b,c})) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DBP
#define deb(...) fprintf(stderr,__VA_ARGS__)
#else
#define deb(...) 0
#endif
#define fst first
#define snd second
#define fore(x,a,b) for(int x=(a), qwerty=(b); x<qwerty; x++)
#define pb push_back
#define mset(a,v) memset((a),(v),sizeof(a))
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) int((a).size())
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

int main(){FIN;
	ll a, b, c; cin >> a >> b >> c;
	ll ans = b;
	ans += min(a+b+1, c);
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int x, a, b;

    cin >> x >> a >> b;

    if (b-a <= 0)       cout << "delicious" << endl;
    else if (b-a <= x)  cout << "safe" << endl;
    else                cout << "dangerous" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int nx[4]={0,1,-1,0};
int ny[4]={1,0,0,-1};
int main(){
  string s,t;
  cin>>s>>t;
  vector<char> ss(s.size()),tt(sz(t));
  rep(i,sz(s)){
    ss[i]=s[i];
  }
  rep(i,sz(t)){
    tt[i]=t[i];
  }
  sort(all(ss));
  sort(rall(tt));
  rep(i,min(sz(ss),sz(tt))){
    if(ss[i]>tt[i]){
      COUT("No");
      return 0;
    }
    else if(ss[i]<tt[i]){
      COUT("Yes");
      return 0;
    }
  }
  if(sz(ss)<sz(tt)){
    COUT("Yes");
  }
  else{
    COUT("No");
  }
}
      


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
  static void Main(string[] args)
  {
    string s = Console.ReadLine();
    int min=999;
    for(int i=0;i<s.Length-2;i++){
      var work = int.Parse(s.Substring(i,3))-753;
      if(work<0) work=work*-1;
      if(min>work) min=work;
    }
    
    Console.WriteLine(min);
  }
}

Measured memory_bytes: 11092
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  h,w=LI()

  a=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]

  l=[]
  for i in range(h):
    l.append(list(S()))

  for i in range(h):
    for j in range(w):
      if l[i][j]!='#':
        c=0
        for x in a:
          if i+x[0]>=0 and i+x[0]<h and j+x[1]>=0 and j+x[1]<w:
            if l[i+x[0]][j+x[1]]=='#':
              c+=1

          l[i][j]=str(c)

  for x in l:
    print(''.join(x))

main()


Measured memory_bytes: 6304
#include <bits/stdc++.h>
using namespace std;
long long a[200010],sum[200010];
typedef long long LL;
LL absll(LL a){
    if(a<0){
        return -a;
    }else{
        return a;
    }
}
int main(){
    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
        sum[i] = sum[i-1]+a[i];
    }
    long long minn = 0x9f9f9f9f;
    long long all = sum[n];
    for(int i=1; i<=n-1; i++){
        long long back = all-sum[i];
        if(absll(back-sum[i])<minn){
            minn = absll(back-sum[i]);
        }
    }
    cout << minn <<endl;
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
  
using namespace std;
  
#define NMAX 10000
#define NOT -1
  
int main(){
  
    int n, k, m;
    int be;
    int list[NMAX+1];
  
    while (1){
  
        cin >> n >> k >> m;
        if (n == 0 && k == 0 && m == 0) break;
  
        for (int i = 1; i < n; i++){
            list[i] = i + 1;
        }
        list[n] = 1;
 
        if(m!=1){
            list[m- 1]=list[m];
            list[m] = NOT;
			be=m;
            m = list[m - 1];
        }
        else{
            list[n]=list[m];
            list[m]=NOT;
			be=m;
            m=list[n];
        }
 
        n--;
        while (n!=1){
            for (int i = 0; i < k-1; i++){
                be = m;
                m = list[m];
            }
            list[be] = list[m];
            list[m] = NOT;
            m = list[be];
            n--;
        }
        cout << m << endl;
  
    }
  
    return 0;
}

Measured memory_bytes: 1196
N = int(input())
li = list(map(int,input().split()))
li_sum = sum(li)

for i in range(len(li)):
    if i == 0:
        continue
    j = i - 1
    if li[i] < li[j]:
        li[i] += li[j] - li[i]

print(sum(li) - li_sum)

Measured memory_bytes: 94092
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>


using namespace std;


int main() {

    long A, B, C, K;
    cin >> A >> B >> C >> K;

    long sum = 0;

    if (A >= K) {
        sum += K;
    } else {
        sum += A;
        K = K - A;
        if (B >= K) {
            sum += 0;
        } else {
            sum += 0;
            K = K - B;
            if (C >= K) {
                sum += (-1 * K);
            } else {
                sum += (-1 * C);
            }
        }
    }


    cout << sum << endl;

    return 0;

}

Measured memory_bytes: 3188
#include<map>
#include<cstdio>
#include<iostream>

#define For(a, b, c) for(int a = b; a <= c; ++a)
using namespace std;
int n, m;
map <int, int> s;

inline int read(){
	int u = 0;
	char x = getchar();
	while(x < '0' || x > '9') x = getchar();
	while(x >= '0' && x <= '9') u = (u << 3) + (u << 1) + (x ^ 48), x = getchar();
	return u;
}

int main(){
	n = read();
	For(i, 1, n) ++s[read()];
	m = read();
	For(i, 1, m){
		if(--s[read()] == -1){
			printf("NO");
			return 0;
		}
	}
	printf("YES");
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

int main() {
  ll n;
  cin >> n;
  for(ll i=0;i<n;i++) {
    char s;
    cin >> s;
    if(s=='Y') {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int MOD=1e9+7;
int main(){
    string s;
    cin>>s;
    string t;
    cin>>t;
    int ret=0;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i])ret++;
    }
    cout<<ret<<endl;
}

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

int main() {
	string S;
	cin >> S;
	int N = S.length();
	int k = 1 << (N - 1);
	long long sum = 0;
	for (int i = 0; i < k; i++) {
		long long num = (long long)S[0] - '0';
		for (int j = 0; j < N - 1; j++) {
			if ((i & 1 << j) > 0) {
				sum += num;
				num = (long long)S[j + 1] - '0';
			}
			else num = num * 10 + S[j + 1] - '0';
		}
		sum += num;
	}
	cout << sum;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int n,ans;
map <int,int> m;
map <int,int> :: iterator itr;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
        int temp; cin>>temp;
        m[temp]++;
    }
    for(itr = m.begin(); itr != m.end() ; itr++){
        int f = itr->se;
        int x = itr->fi;
        if(f>x){ans+=f-x;}
        else if(f<x){ans+=f;}
    }
    cout<<ans<<newl;

}


Measured memory_bytes: 4736
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 1000005;
const int K = 25;
int c[N], a[N], b[N], n;
bool ok(int x){
    for (int i = 1; i < n + n; i++) if (a[i] >= x) b[i] = 1; else b[i] = 0;
    int c = b[n];
    int l = n - 1;
    int r = n + 1;
    while(l > 0){
        if (b[l] == c || b[r] == c){
            return (c == 1);
        }
        l--;
        r++;
        c ^= 1;
    }
    return (c == 1);
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n + n - 1; i++) cin >> a[i];
    int l = 2;
    int r = n + n - 1;
    while(r - l > 1){
        int mid = (r + l) / 2;
        if (ok(mid)) l = mid; else r = mid;
    }
    cout << l;
}


Measured memory_bytes: 5888
# -*- coding: utf-8 -*-
H, W = map(int, input().split(' '))
A = [input() for _ in range(H)]

n = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            n += 1

if n == (H + W - 1):
    print('Possible')
else:
    print('Impossible')






Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111

ll mo=1000000007;
 
ll modpow(ll a, ll n) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}
 
ll comb(int P_,int Q_) {
	if(P_<0 || Q_<0 || Q_>P_) return 0;
	ll p=1,q=1;
	Q_=min(Q_,P_-Q_);
	for(int i=1;i<=Q_;i++) p=p*P_%mo, q=q*i%mo,P_--;
	
	return p*modpow(q,mo-2)%mo;
}
 
ll hcomb(int Q_,int P_) { return (P_==0&&Q_==0)?1:comb(P_+Q_-1,Q_);}
 
map<ll,int> enumpr(ll n) {
	map<ll,int> V;
	
	for(int i=2;i*i<=n;i++) {
		while(n%i==0) {
			V[i]++;
			n/=i;
		}
	}
	if(n>1) V[n]++;
	return V;
}
	vi morty(310000,0);

	void solve(){

		
		ini(n);
		ini(n1);
		auto map1 = enumpr(n1);
		int rick = 1;
		FORR(x,map1){
			rick*=hcomb(x.second,n)%mo;
			rick%=mo;
		}
		out(rick);

















	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

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

#define pb push_back
#define mp make_pair
#define loop1(x,s,e) for(int x=s;x!=e;x+=1-2*(s>e))
#define input_matrix(a,m,n) for(int i=0;i<m;i++)for(int j=0;j<n;j++)cin>>a[i][j];
#define input_array(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define all(x) x.begin(),x.end()
#define newl "\n"
#define tests(t) int t; cin>>t; while(t--)
#define speed ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
//########################################################################




int main()
 {
	int n; cin>>n;
	int l=n/2;
	float ans;
	ans=1-((double)l/n);
	printf("%0.10f",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,ans,f[2005],a[2005][2005],l[2005],r[2005]; char S[2005];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i){
		scanf("%s",S+1);
		for (int j=1;j<=m;++j) a[i][j]=S[j]=='#';
	}
	for (int j=1;j<m;++j) f[j]=1; ans=max(n,m);
	for (int i=n-1;i;--i){
		for (int j=m-1;j;--j)
		if (a[i][j]^a[i][j+1]^a[i+1][j]^a[i+1][j+1])
		f[j]=1; else ++f[j];
		for (int j=1,k;j<m;l[j++]=k)
		for (k=j-1;f[k]>=f[j];k=l[k]);
		for (int j=m-1,k;j;r[j--]=k)
		for (k=j+1;f[k]>=f[j];k=r[k]);
		for (int i=1;i<m;++i)
		ans=max(ans,f[i]*(r[i]-l[i]));
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;
int N,M;
int tate[1600000];
int yoko[1600000];
int tate2[1600000];
int yoko2[1600000];
int ans;
int tata;
int yoyo;
int main(){
	while(1){
	cin >> N >> M;
	if(N==0&&M==0) return 0;
	for(int i=0;i<1600000;i++){
		tate[i]=0;
		yoko[i]=0;
		tate2[i]=0;
		yoko2[i]=0;
	}
	ans = 0;
	tata = 0;
	yoyo = 0;
	for(int i=0;i<N;i++){
		cin >> tate[i];
	}
	for(int i=0;i<M;i++){
		cin >> yoko[i];
	}
	for(int i=0;i<N;i++){
		tata = 0;
		for(int j=0;j<N-i;j++){
			tata += tate[i+j];
			tate2[tata] ++;
		}
	}
	for(int i=0;i<M;i++){
		yoyo = 0;
		for(int j=0;j<M-i;j++){
			yoyo += yoko[i+j];
			yoko2[yoyo] ++;
		}
	}
	for(int i=0;i<1600000;i++){
		if(tate2[i]*yoko2[i] !=0){
		}
		ans += tate2[i]*yoko2[i];
	}
	cout << ans << endl;
	}
}

Measured memory_bytes: 28028
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  mint ans = 0;
  rep(i, n){
    int ac = 0, bc = 0;
    rep(j, n){
      if(a.at(i) > a.at(j)){
        if(i < j) bc++;
        ac++;
      }
    }
    mint add = (ll)bc*k;
    // add += (ll)ac * k * (k+1)/2;
    mint ad2 = (ll)ac;
    ad2 *= (ll)k*(k-1)/2;
    // cerr << ac << " " << bc << " " << add.x << " " << ad2.x << endl;
    add += ad2;
    ans += add;
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>

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

  int d_n, m_n;                                                                                                                    
  d_n = n / 10;                                                                                                                    
  m_n = n % 10;                                                                                                                    

  if(d_n == 9 || m_n == 9) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-7)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

//作成中
class Point3d{
public:
  double x,y,z;

  Point3d(double x=0,double y=0,double z=0):x(x),y(y),z(z){}

  Point3d operator + (const Point3d& a){
    return Point3d(x+a.x,y+a.y,z+a.z);
  }
  Point3d operator - (const Point3d& a){
    return Point3d(x-a.x,y-a.y,z-a.z);
  }
  Point3d operator * (const double& d){
    return Point3d(x*d,y*d,z*d);
  }
  Point3d operator / (const double& d){
    return Point3d(x/d,y/d,z/d);
  }

  bool operator < (const Point3d& p)const{
    return !equals(x,p.x)?x<p.x:((!equals(y,p.y))?y<p.y:z<p.z);
  }

  bool operator == (const Point3d& p)const{
    return equals(x,p.x) && equals(y,p.y) && equals(z,p.z);
  }

};

struct Segment3d{
  Point3d p[2];
  Segment3d(Point3d p1=Point3d(),Point3d p2=Point3d()){
    p[0] = p1, p[1] = p2;
  }
  bool operator == (const Segment3d& seg)const{
    return p[0] == seg.p[0] && p[1] == seg.p[1];
  }
};

typedef Point3d Vector3d;
typedef Segment3d Line3d;

ostream& operator << (ostream& os,const Point3d& p){
  os << "(" << p.x << "," << p.y << "," << p.z << ")";
}

ostream& operator << (ostream& os,const Segment3d& seg){
  os << "(" << seg.p[0] << "," << seg.p[1] << ")";
}

double dot(const Point3d& a,const Point3d& b){
  return a.x*b.x + a.y*b.y + a.z*b.z;
}

Vector3d cross(const Point3d& a,const Point3d& b){
  return Vector3d(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);
}

bool point_on_the_triangle3d(Point3d tri1,Point3d tri2,Point3d tri3,Point3d p){
  Vector3d v1 = tri2 - tri1;
  Vector3d v2 = tri3 - tri2;
  Vector3d v3 = tri1 - tri3;
  bool res  = ( cross(v1,p-tri1).z >= 0 ); //線分上にある場合もtrue,　線分上にある場合は駄目とするならば > 0 とすること
  bool res2 = ( cross(v2,p-tri2).z >= 0 );
  bool res3 = ( cross(v3,p-tri3).z >= 0 );
  return res == res2 && res2 == res3;
}

const string Y = "YES", N = "NO";
int main(){
  Point3d tri[3],p;
  while(cin >> tri[0].x >> tri[0].y >> tri[1].x >> tri[1].y >> tri[2].x >> tri[2].y >> p.x >> p.y){
    cout << (point_on_the_triangle3d(tri[0],tri[1],tri[2],p)?Y:N) << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include<bits/stdc++.h>
#define        ll          long long int
#define        sz          200010
#define        fast        ios_base :: sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define        sc1(a)      scanf("%lld",&a)
#define        sc2(a,b)    scanf("%lld %lld",&a,&b)
#define        pb          push_back
#define        pn          printf("No\n")
#define        py          printf("Yes\n")
#define        op(a)       printf("%lld\n",a)

using namespace std;

vector<ll>vt[sz];
ll num[sz];

int main()
{

    ll n,m,k,a,x,p,s,c,d,b,i,j;

    cin>>n>>m;

    for(i=1;i<=n;i++)cin>>num[i];

    while(m--)
    {
        cin>>a>>b;
        vt[a].pb(b);
        vt[b].pb(a);

    }
    c=0;

    for(i=1;i<=n;i++)
    {
        x=num[i];
        ll f=0;

        for(j=0;j<vt[i].size();j++)
        {
            b=vt[i][j];
            if(num[b]>=x)
            {
                f=1;
                break;
            }
        }
        if(f==0)c++;
    }


    cout<<c<<endl;

    return 0;
}



Measured memory_bytes: 12600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	vector<set<int>> g(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--,b--;
		g[a].insert(b);
		g[b].insert(a);
	}
	vector<int> per;
	FOR(i,1,n) per.push_back(i);
	int ans=0;
	do{
		bool flag=true;
		int now=0;
		for(auto to:per){
			if(!g[now].count(to)){
				flag=false;
				break;
			}
			now=to;
		}
		if(flag) ans++;
	}while(next_permutation(begin(per),end(per)));
	cout<<ans<<endl;
}

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

int down(const void *a,const void *b){
  return *(int *)b - *(int *)a;
}

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

  int m = 3*n;
  int a[m];
  for(int i = 0;i < m;i ++){
    scanf("%d",&a[i]);
  }

  qsort(a,m,sizeof(int),down);
  long long ans = 0;
  for(int i = 1;i < 2*n;i += 2){
    ans += a[i];
  }

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

  return 0;
}

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

int main(){
	int N,A,B;
	string S;
	cin>>N>>A>>B;
	cin>>S;
	int c=0,d=0;
	for(int i=0;i<N;i++){
		if(S[i] == 'a'){
			if(c < A + B){
				cout<<"Yes"<<endl;
				c++;
			}
			else{
				cout<<"No"<<endl;
			}
		}
		else if(S[i] == 'b'){
			if(c < A+B && d < B){
				cout<<"Yes"<<endl;
				c++;
				d++;
			}
			else{
				cout<<"No"<<endl;
			}
		}
		else{
			cout<<"No"<<endl;
		}
	}
}

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

int main() {
    string x; cin >> x;
    
    while (x != "0") {
        int digit_sum = 0;
        for (int i = 0; i < x.size(); ++i) {
            int num = x[i] - '0';
            digit_sum += num;
        }
        cout << digit_sum << endl;
        
        cin >> x;
    }
    
    return 0;
}


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

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

	double ans = 0;
	for(int i = 1; i <= n; i++){
		double pro = 1;
		int now = i;
		while(now < k){
			pro *= 0.5;
			now *= 2;
		}
		ans += pro/n;
	}

	cout << fixed << setprecision(10) << ans << endl;

	return 0;
}

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

tele = [0]
cnt = [1] + [0] * (N-1)
while True:
    nt = A[tele[-1]] -1
    if cnt[nt] == 1:
        rest = tele.index(nt) 
        roop = len(tele) - rest
        break
    tele.append(nt)
    cnt[nt] += 1

if K < len(tele):
    print(tele[K]+1)
else:
    K -= rest
    K %= roop
    print(tele[rest+K]+1)


Measured memory_bytes: 32208
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans=0;
  long long a[1000000];
  cin>>n;
  for(int i=0;i<n*3;i++){
    cin>>a[i];
  }
  sort(a,a+n*3);
  reverse(a,a+n*3);
  for(int i=0;i<n*3;i++){
    if(i%2==1&&i<n*2){
      ans+=a[i];
    }
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 4480
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <numeric>
#include <ctime>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <map>

using namespace std;
typedef long long int lint;

void paint(int H, int W, int** map, int x, int y, int kind)
{
	if (x < 0 || x >= W) return;
	if (y < 0 || y >= H) return;
	if (map[y][x] != kind) return;
	map[y][x] = -1;
	paint(H, W, map, x - 1, y, kind);
	paint(H, W, map, x + 1, y, kind);
	paint(H, W, map, x, y - 1, kind);
	paint(H, W, map, x, y + 1, kind);
}

int solve(int H, int W, int** map)
{
	int count = 0;
	for (int y = 0; y < H; y++){
		for (int x = 0; x < W; x++){
			if (map[y][x] == -1) continue;
			paint(H, W, map, x, y, map[y][x]);
			count++;
		}
	}
	return count;
}

int main()
{
	//clock_t start = clock();

	while (1)
	{
		int H, W;
		cin >> H >> W;
		if (H == 0 && W == 0) break;
		int** map = new int*[H];
		for (int i = 0; i < H; i++) map[i] = new int[W];
		string buf;
		for (int i = 0; i < H; i++){
			cin >> buf;
			for (int j = 0; j < W; j++){
				if (buf[j] == '@')			map[i][j] = 1;
				else if (buf[j] == '#')		map[i][j] = 2;
				else						map[i][j] = 3;
			}
		}
		cout << solve(H, W, map) << endl;
		for (int i = 0; i < H; i++) delete[] map[i];
		delete[] map;
	}

	//clock_t end = clock();
	//std::cout << (double)(end - start) / CLOCKS_PER_SEC << "sec.\n";

	return 0;
}

Measured memory_bytes: 2176
import numpy as np
import math

N = int(input())

A = np.empty(N)
for i in range(N):
   A[i] = int(input())


max_a = np.max(A)
max_i = np.argmax(A)

for i in range(N):
   if(i == max_i):
      aa = np.sort(A)
      print(int(aa[-2]))
   else:
      print(int(max_a))

Measured memory_bytes: 21516
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i = s; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using field = vector<vector<T>>;

template<class T> inline bool chmax(T& a,T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int n,t;
  cin >> n >> t;
  vector<P> data(n);
  rep(i,0,n) {
    int a,b;
    cin >> a >> b;
    data[i] = P(a,b);
  }
  sort(data.begin(), data.end());
  field<int> dp(n+1,vector<int>(t+1,0));
  int ans = 0;
  rep(i,0,n) {
    int a = data[i].first, b = data[i].second;
    rep(j,0,t) {
      chmax(dp[i+1][j],dp[i][j]);
      if (j+a < t) {
        chmax(dp[i+1][j+a],dp[i][j]+b);
      }
    }
    chmax(ans,dp[i][t-1]+b);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 38636
#include<bits/stdc++.h>
using namespace std;
int sum;
int main()
{
	int n,k,a[10001];
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	for(int i=n;i>0;i--)
	{
		k--;
		sum+=a[i];
		if(k==0) break;
		//cout<<a[i]<<endl;
	}
	cout<<sum<<endl;
	return 0;
}

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

using namespace std;

int exponential(int a, int i) {
    if (i == 0)
        return 1;
    else
        return a * exponential(a, i-1);
}

int main() {
    int x;  cin >> x;
    int ans = 1;

    for (int a = 2; a <= sqrt(x); a++) {
        int tmp = a;
        while (tmp <= x) {
            ans = max(tmp, ans);
            tmp *= a;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 100 + 10;

int seq[maxn][maxn];
int colorn[maxn * maxn];
int main(){
	int h,w,n;
	cin >> h >> w >> n;
	for (int i = 0;i < n;i++){
		cin >> colorn[i];
	}
	bool r = true;
	int cr = 0,cc = -1;
	for (int i = 0;i < n;i++){
		for (int j = 0;j < colorn[i];j++){
			if (r){
				if (cc  + 1 == w){
					cr++;
					r = false;
				}else cc++;
				seq[cr][cc] = i + 1;
			}else{
				if (cc == 0){
					cr++;
					r = true;
				}else cc--;
				seq[cr][cc] = i + 1;
			}
		}
	}
	for (int i = 0;i < h;i++){
		for (int j = 0;j < w;j++){
			cout << seq[i][j] << ' ';
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
n,q=map(int,input().split())
d={i:[] for i in range(n)}
for i in range(n-1):
    a,b=map(int,input().split())
    d[a-1].append(b-1)
counter = [0 for i in range(n)]
for i in range(q):
    p,x=map(int,input().split())
    counter[p-1]+=x
for i in range(n-1):
    for child in d[i]:
        counter[child]+=counter[i]
print(' '.join(map(str, map(int,(counter)))))

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


void solve(long long X){
    if(X <= 599) cout << 8 << endl;
    else if(X >= 600 && X <= 799) cout << 7 << endl;
    else if(X >= 800 && X <= 999) cout << 6 << endl;
    else if(X >= 1000 && X <= 1199) cout << 5 << endl;
    else if(X >= 1200 && X <= 1399) cout << 4 << endl;
    else if(X >= 1400 && X <= 1599) cout << 3 << endl;
    else if(X >= 1600 && X <= 1799) cout << 2 << endl;
    else if(X >= 1800 && X <= 1999) cout << 1 << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define ll long long
#define debug(a) cout<<a<<endl
#define pii pair<int,int>
#define maxn 19
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int a,b;
    int p[maxn];
    vector<int> sw[maxn];
    cin>>a>>b;
    for(int i=0;i<b;i++){
        int k;
        cin>>k;
        for(int t=0;t<k;t++){
            int z;
            cin>>z;
            sw[i].push_back(z);
        }
    }
    for(int i=0;i<b;i++){
        cin>>p[i];
    }
    int ans =0;
    for(int i=0;i<=a;i++){
    int vet[10]={1,1,1,1,1,1,1,1,1,1};
            for(int j=0;j<i;j++){
                vet[j]=0;
            }
            bool first=true;
            while(first || next_permutation(vet,vet+a)){
             bool cond=true;
             for(int t=0;t<b;t++){
                  int cont=0;
                  for(auto e: sw[t]){
                      if(vet[e-1]==1)cont++;
                  }
                  if(cont%2!=p[t])cond=false;      
                }
                if(cond)ans++;
                first=false;
            }
    }
    cout<<ans<<endl;
    return 0;
}
///usar double sempre ou long double
///pensar em casos que coisas dao negativas
///N esquecer de limpar as coisas em quest de varios testes
///OLHAR A COMPLEXIDADE PRA VER SE N PASSA POR BRUTE FORCE OU BRUTE FORCE COM ALGUMAS OTIMIZACOES

Measured memory_bytes: 256
/*
	JAI JAGANNATH!
*/
//@Author : zanj0

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

typedef long long int lli;

#define ff              first
#define ss              second
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            lli x; cin>>x; while(x--)

void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}
void solve() {
	long double d, tt, x;
	cin >> d >> tt >> x;
	cout << (((d / tt) <= x) ? "Yes" : "No") << endl;
}
int main()
{
	zanj0();
	solve();
	return 0;
}

Measured memory_bytes: 3728
package main

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

const (
	maxBufSize = 1024 * 1024
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, 1)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	out = bufio.NewWriter(os.Stdout)
)

func solve(n int64, as []int64) int64 {
	aas := make(map[int64]int64)
	for i, a := range as {
		v := a - int64(i)
		c, ok := aas[v]
		if !ok {
			aas[v] = 1
		} else {
			aas[v] = c + 1
		}
	}
	ret := int64(0)
	for i, a := range as {
		v := a + int64(i)
		c, ok := aas[-v]
		if ok {
			ret += c
		}
	}
	return ret
}

func main() {
	defer out.Flush()

	n := nextInt()
	as := nextInts(n)
	res := solve(n, as)
	fmt.Fprintln(out, res)
}

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

func nextStringAsBytes() []byte {
	sc.Scan()
	return []byte(sc.Text())
}

func nextInt() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int64) []int64 {
	ret := make([]int64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

func nextFloats(n int64) []float64 {
	ret := make([]float64, n)
	for i := int64(0); i < n; i++ {
		ret[i] = nextFloat()
	}
	return ret
}
func nextStrings(n int64) []string {
	ret := make([]string, n)
	for i := int64(0); i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func containStr(arr []string, target string) bool {
	for _, v := range arr {
		if v == target {
			return true
		}
	}
	return false
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "orz")
	}
}

// mapからkeysとvaluesを返す
func splitKeyValue(m map[interface{}]interface{}) (keys, values []interface{}) {
	switch reflect.TypeOf(m).Kind() {
	case reflect.Map:
		s := reflect.ValueOf(m)
		for _, v := range s.MapKeys() {
			keys = append(keys, v)
			values = append(values, s.MapIndex(v))
		}
	default:
		fmt.Fprintln(out, "orz")
	}
	return
}


Measured memory_bytes: 14848
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
//const int MAX=;



int main(){
	int A,B;
	cin>>A>>B;
	if(A>=13)cout<<B;
	else if(A>=6)cout<<B/2;
	else cout<<0;
}

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

using namespace std;
int x, y;

bool solve(int x, int y){
    for (int i=0; i<=x; i++){
        if (2*i+4*(x-i)==y) return true;
    }
    return false;
}

int main(){
    cin>>x>>y;
    if (solve(x, y)) cout<<"Yes";
    else cout<<"No";
}

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

struct edge{
	int to,color,num;
};
using graph=vector<vector<edge>>;
signed main(){
	int N; cin>>N;
	vector<bool> start(N,true);
	graph G(N);
	for(int i=0;i<N-1;i++){
		int a,b; cin>>a>>b; a--; b--;
		edge tmp; tmp.to=b; tmp.color=0; tmp.num=i;
		G[a].push_back(tmp);
		start[b]=false;
	}
	int S;
	for(int i=0;i<N;i++){
		if(start[i]){S=i; break;}
	}
	vector<set<int>> col(N);
	vector<int> ans(N-1);
	queue<int> que;
	que.push(S);
	int col_num=0;
	while(!que.empty()){
		int v=que.front();
		que.pop();
		int tmp_col=1;
		for(auto i:G[v]){
			first:
			if(!col[v].count(tmp_col) && !col[i.to].count(tmp_col)){
				i.color=tmp_col;
				col[v].insert(tmp_col);
				col[i.to].insert(tmp_col);
				ans[i.num]=tmp_col;
			}
			else{
				tmp_col++;
				goto first;
			}
			que.push(i.to);
			col_num=max(col_num,tmp_col);
		}
	}
	cout<<col_num<<endl;
	for(int i=0;i<N-1;i++)cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 20864
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++){
    cin >> h[i];
  }
  vector<ll> dp(n + 5, 1001001001);
  dp[0] = 0;

  for (int i = 0; i < n; i++){
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
  }
  cout << dp[n - 1] << "\n";
  return 0;
}

Measured memory_bytes: 1408
package main

import "fmt"

var ans = 0
var cr []int

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	ar := make([][]bool, m)
	for i := range ar {
		var k int
		fmt.Scan(&k)
		br := make([]bool, n)
		for j := 0; j < k; j++ {
			var s int
			fmt.Scan(&s)
			br[s-1] = true
		}
		ar[i] = br
	}
	cr = make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&cr[i])
	}
	dr := make([]bool, n)
	f(0, n, dr, ar)
	fmt.Println(ans)
}

func f(n, sw int, dr []bool, ar [][]bool) {
	if n == sw {
		for i, br := range ar { // denkyubangou, tuiterusuitti
			sum := 0
			for j, v := range br { // suittibangou
				if v {
					if dr[j] {
						sum++
					}
				}
			}
			if sum%2 != cr[i] {
				return
			}
		}
		ans++
		return
	}
	dr[n] = true
	f(n+1, sw, dr, ar)
	dr[n] = false
	f(n+1, sw, dr, ar)
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

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

  int sum = a + b + c;
  int max_val = max(max(a, b), c);

  if(sum-max_val == max_val){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }


  return 0;
}


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

using namespace std;

const int MAXN=100000+100;
int f[MAXN];
vector<int> G[MAXN];
int n,m;

void input(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		G[x].push_back(y);
//		in[y]++;
	}
}

int dfs(int nod){
	if(f[nod]) return f[nod];
	int len=G[nod].size(),cur=0;
	for(int i=0;i<len;i++){
		int nex=G[nod][i];
		cur=max(cur,dfs(nex)+1);
	}
	return f[nod]=cur;
}

void work(){
	int ans=0;
	for(int i=1;i<=n;i++){
		ans=max(ans,dfs(i));
	}
	cout<<ans<<endl;
}

int main(){
	input();
	work();
	return 0;
}
/*
4 3
1 2
2 3
1 4
*/

Measured memory_bytes: 8192
import math


def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b


def main():
    n = int(input())
    s = int(input())
    if s == n:
        print(n+1)
        return
    elif s > n:
        print(-1)
        return
    sqrt = int(math.sqrt(n))
    for b in range(2, sqrt+2):
        if f(b, n) == s:
            print(b)
            return
    for x in range(sqrt, 0, -1):
        if x > s:
            continue
        y = s - x
        b = (n - y) // x
        if b >= 2 and (n - y) % x == 0 and f(b, n) == s:
            print(b)
            return
    print(-1)


if __name__ == "__main__":
    main()


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

using namespace std;

#define int long long
#define ar array



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

    int a, v;
    cin >> a >> v;
    int b, w;
    cin >> b >> w;
    int t;
    cin >> t;
    if(v > w && abs(a-b)<=abs(v-w)*t){
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 3584
K = int(input())
A, B = map(int, input().split())
C = range(A,B+1)
for i in C:
  if i % K == 0:
    P = 0
    break
  else:
    P = 1
  
if P == 0:
  print("OK")
elif P == 1:
  print("NG")
   

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

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

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

    int ans = 0;
    for(auto x : mp)
    {
        int t = x.second;
        for(int i = 1; i < 100; i++)
        {
            if(i > t) break;
            ans++;
            t -= i;
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3540
import sys

def main():
    input = sys.stdin.readline
    N, K = map(int, input().rstrip().split())
    trees = []

    for _ in range(N):
        trees.append(int(input()))

    trees.sort()
    min_diff = float("inf")

    for i in range(K-1, N):
        min_diff = min(min_diff, trees[i]-trees[i-K+1])
        
    
    print(min_diff)



if __name__ == '__main__':
    main()
    

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

int main() {
  int N , M ;
  cin >> N >> M ;
  vector<int>city(N);
  for ( int i = 0 ; i < M ; i++ ){
    int a , b;
    cin >> a >> b ;
    city.at(a-1)++;
    city.at(b-1)++;
  }
  for ( int i = 0 ; i < N ; i ++ ){
    cout << city.at(i) << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <map>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define ITR(c,it)  for(auto it = c.begin(); it != c.end(); it++)

typedef long long ll;

const int N_MAX = 300000;

ll N, A, B;
ll a[N_MAX];

map<ll, int> mp;

void compress() {
  REP(i, N) mp[a[i]] = 1;
  int k = 1;
  ITR(mp, it) it->second = k++;
  REP(i, N) a[i] = mp[a[i]];
}

void solve() {
  if (A + B > N + 1) {
    puts("-1");
    return;
  }
  if (A * B < N) {
    puts("-1");
    return;
  }
  int M = N + 1 - A - B;
  int k = 0;
  REP(j, B) REP(i, A) {
    if (i > 0 && j > 0) {
      ll k2 = (j - 1) * (A - 1) + i - 1;
      if (k2 >= M) break;
    }
    a[k++] = B * (i + 1) - j;
  }
  compress();
  REP(i, N) printf("%d%c", a[i], i + 1 == N ? '\n' : ' ');
}

void input() {
  scanf("%lld%lld%lld", &N, &A, &B);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 23424