akhauriyash/Code-Regression huggingface dataset:
//  -- ILSH -- //
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define viii vector < vii >
#define vlll vector < vll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=200000+6;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    for ( int i=0;i<n;i++)
    {
        cout<<s[i]<<t[i];
    }
    cout<<'\n';
}

Measured memory_bytes: 256
#include <stdio.h>

int num[10]={1,2,3,4,5,6,7,8,9,0}, dp[11][331];
#define exch(A,B) {int t; t=A, A=B, B=t;}

/* k¶Úðßé, sÉÍ»Ì_ÅÌað */
void solve(int k, int s){
     int i, j, ts;

     for(i=k; i<10; i++){
	  exch(num[i],num[k]);

	  /* n=kÅÌsðL^ */
	  ts=s;
	  ts+=num[k]*(k+1);
	  dp[k+1][ts]++;

	  if(k<9) solve(k+1,ts);

	  exch(num[i],num[k]);
     }
}

int main(int argc, char *argv[]){
     int n, s;

     solve(0,0);
     
     while(~scanf("%d %d",&n,&s))
	  printf("%d\n",(n<=10 && s<=330)?dp[n][s]:0);

     return 0;
}

Measured memory_bytes: 292
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(void){
    
    //入力
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    
    //０と１の個数を調べる(１の個数で始まり１の個数で終わる)
    vector<int> nums;
    int now = 1;
    int cnt = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == (char)(now + '0')) cnt++;
        else {
            nums.push_back(cnt);
            cnt = 1;
            now = 1 - now;
        }
    }
    if (cnt != 0) nums.push_back(cnt);
    if (nums.size() % 2 == 0) nums.push_back(0);
    
    //累積和を作る
    vector<int> sums(nums.size() + 1);
    for (int i = 0; i < nums.size(); i++){
        sums[i + 1] = sums[i] + nums[i];
    }
    
    //答えを計算する
    int Add = 2 * K + 1;
    int ans = 0;
    for (int i = 0; i < nums.size(); i += 2){
        int left = i;
        int right = min(i + Add, (int)nums.size());
        int tmp = sums[right] - sums[left];
        ans = max(ans, tmp);
    }
    
    //出力
    cout << ans << endl;
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  if ((a == b && a != c) || (a == c && a != b) || (b == c && a != b))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long h;
    cin >> h;
    long long store;
    store = h;

    vector<long long> vc;
    long long two = 1;
    long long sum = 0;

    while (two <= h)
    {
        vc.push_back(two);
        two *= 2;
    }
    vc.push_back(two);
    two *= 2;
    h = store;
    // cout << h << endl;

    // vector<long long>::iterator lit = lower_bound(vc.begin(), vc.end(),h);
    auto lit = lower_bound(vc.begin(), vc.end(), h);
    // cout << *lit << endl;
    if (*lit == h)
    {
        for (long long i = 1; i <= *lit; i *= 2)
        {
            sum += i;
        }
        cout << sum << endl;
        return 0;
    }
    for (long long i = 1; i < *lit; i *= 2)
    {
        sum += i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	unsigned long long int n,a,b;
	cin>>n>>a>>b;
	unsigned long long int ans = n/(a+b)*a;
	if(n%(a+b)>a)
	{
		ans += a;
	}
	else
	{
		ans += n%(a+b);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
public class Shikaku{
    public static void Main(){
        string[] line = System.Console.ReadLine().Trim().Split(' ');
        int a = int.Parse(line[0]);
        int b = int.Parse(line[1]);
        System.Console.WriteLine((a * b).ToString() + " " + (a * 2 + b * 2).ToString());
    }
}

Measured memory_bytes: 5600
#include <iostream>
#include <string.h>
using namespace std;
int main(void){
  char s[100];
  int K;
   cin>>s>>K;
   int N;
   N=strlen(s);
   int ans;
   int num=0;
   ans=0;
  
   for(int i=0;i<N;i++){
      if(s[i]!='1') {num=1;break;}
      ans++;
   }
   if(num==1&&(ans<K)){cout<<s[ans];}
   else cout<<1;
   return 0;
}

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

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  int count=0;
  int count_b=0;
  for(int i=0;i<n;i++){
    if(s.at(i) == 'a' && count < a+b){
      count++;
      cout << "Yes" <<endl;
    }
    else if (s.at(i) == 'b' && count < a+b && count_b < b){
      count++;
      count_b++;
      cout << "Yes" << endl;
    }
    else
      cout << "No" << endl;
  }      
}


Measured memory_bytes: 3752
n = input()

if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")

elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")

else:
    print("bon")

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

int main(void){
  int N; cin >> N;
  vector<int> S(N);
  for(int i = 0; i < N; i++) cin >> S[i];
  int M; cin >> M;
  vector<int> T(M);
  for(int i = 0; i < M; i++) cin >> T[i];

  int ans = 0;
  for(int i = 0; i < M; i++){
    for(int j = 0; j < N; j++){
      if(S[j] == T[i]){
        ans++;
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1232
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
const ll E=1e17+7;
#define F first
#define S second
#define MK make_pair




int main(){
    int h,w;
    cin>>h>>w;
    int a[100][100]={};
    for(int i=0;i<h;i++){
        for(int t=0;t<w;t++){
            char c;
            cin>>c;
            if(c=='#'){a[i][t]=1;}
        }
    }
    bool j=true;
    for(int i=0;i<h && j;i++){
        for(int t=0;t<w && j;t++){
            if(a[i][t]==1){
                bool k=false;
                if(i!=0 && a[i-1][t]==1){k=true;}
                if(t!=0 && a[i][t-1]==1){k=true;}
                if(a[i+1][t] || a[i][t+1]){k=true;}
                if(!k){j=false;}
            }
        }
    }
    cout<<(j?"Yes":"No")<<endl;
    
    return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    const ll MOD = 998244353;
    ll n, s;
    cin >> n >> s;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(s+1, vector<ll>(3,0)));
    dp.at(0).at(0).at(0) = 1;
    for(i = 0;i < n;++i){
        rep(j,s+1){
            dp.at(i+1).at(j).at(0) += dp.at(i).at(j).at(0);
            dp.at(i+1).at(j).at(0) %= MOD;
            dp.at(i+1).at(j).at(1) += dp.at(i).at(j).at(0) + dp.at(i).at(j).at(1);
            dp.at(i+1).at(j).at(1) %= MOD;
            dp.at(i+1).at(j).at(2) += dp.at(i).at(j).at(0) + dp.at(i).at(j).at(1) + dp.at(i).at(j).at(2);
            dp.at(i+1).at(j).at(2) %= MOD;
            if(j + a.at(i) <= s){
                ll tmp = j + a.at(i);
                dp.at(i+1).at(tmp).at(1) += dp.at(i).at(j).at(0) + dp.at(i).at(j).at(1);
                dp.at(i+1).at(tmp).at(1) %= MOD;
                dp.at(i+1).at(tmp).at(2) += dp.at(i).at(j).at(0) + dp.at(i).at(j).at(1);
                dp.at(i+1).at(tmp).at(2) %= MOD;
            }
        }
    }
    cout << dp.at(n).at(s).at(2)%MOD << endl;
    return 0;
}


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    ll R,G,B,N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for (int i = 0; i <= N; ++i) {
        for (int k = 0; k <= N; ++k) {
            //現在の個数
            int num = R*i + G*k;
            //残りの必要数
            int p = N - num;
            if (p == 0) {
                ans++;
            } else if (p > 0 && p % B == 0)  {
                ans++;
            }
        }
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
MAX_INT = 10**4+1
cumsum = [0] * (MAX_INT)

# 3~6
for i in range(3, 150):
  seen = []
  for n in range(1, i+1):
    for m in range(n, i+1):
      k = i - n - m
      if k <= 0: continue
      tmp = [n,m,k]
      tmp.sort()
      if tmp in seen: continue
      seen.append(tmp)

      p = i*i - (n*m + m*k + k*n)
      if p >= MAX_INT: break
      l = len(list(set(tmp)))
  
      if l==3:
        add = 6
      elif l==2:
        add = 3
      else:
        add = 1

      cumsum[p] += add
      
for i in range(1, N+1):
  print(cumsum[i])

Measured memory_bytes: 78332
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
using namespace std;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
 

 int n;
 map<string,int> mp; 

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
  	cin>>n;
  	string s;
  	 while(n--){
  	 	cin>>s;
  	 	mp[s]++;
  	 }
  	 cout<<"AC"<<" "<<"x"<<" "<<mp["AC"]<<endl;
  	 cout<<"WA"<<" "<<"x"<<" "<<mp["WA"]<<endl;
  	 cout<<"TLE"<<" "<<"x"<<" "<<mp["TLE"]<<endl;
  	 cout<<"RE"<<" "<<"x"<<" "<<mp["RE"]<<endl;



    return 0;
}

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


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

  ll n;
  cin >> n;
  vll a(n);
  REP(i, n)
    cin >> a[i];

  ll ans = 0;
  REP(i, n){
    ans += a[i]/2;
    if(i+1<n){
      if(a[i+1] != 0)
        a[i+1] += a[i]%2;
    }
  }

  cout << ans << endl;


}


Measured memory_bytes: 1024
# frozen_string_literal: true
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
  #Rubyパスを取得するには、rbconfigかrubygemsを使う。AtCoderでは--disable-gemsされているので、require 'rubygems'は必須である。
  #require 'rbconfig';RUBY=File.join(RbConfig::CONFIG['bindir'],RbConfig::CONFIG['ruby_install_name'])
  require 'rubygems';RUBY=Gem.ruby
  exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},RUBY,$0) #100MB
end

class Node
  attr_accessor :parent, :left, :right, :depth

  def initialize(parent, left, right)
    @parent = parent || -1
    @left = left
    @right = right
    @depth = nil
  end
end

def set_depth(node, p, nodes)
  node.depth = p
  set_depth(nodes[node.right], p, nodes) if node.right
  set_depth(nodes[node.left], p + 1, nodes) if node.left
end

def children(node, nodes)
  children = []
  child = node.left
  while child
    children << child
    child = nodes[child].right
  end

  children
end

n = gets.to_i
array = readlines.map { |s| s.split.map(&:to_i) }

nodes = []
n.times do
  nodes << Node.new(nil, nil, nil)
end

array.each do |e|
  id = e[0]
  k = e[1]
  children = e.slice(2..-1)

  nodes[id].left = children.first
  children.each_with_index do |child, i|
    nodes[child].parent = id
    nodes[child].right = children[i + 1]
  end
end

root = nodes.find { |e| e.parent == -1 }

set_depth(root, 0, nodes)

nodes.each_with_index do |node, id|
  type = if node.parent == -1
           'root'
         elsif node.left
           'internal node'
         else
           'leaf'
  end

  puts "node #{id}: parent = #{node.parent}, depth = #{node.depth}, #{type}, #{children(node, nodes).inspect}"
end



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

const int nmax = 40, abmax = 10, inf = 10000000;

int a[nmax], b[nmax], c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];

int main() {
    int n, ma, mb;
    cin >> n >> ma >> mb;

    rep(i, n) {
        cin >> a[i] >> b[i] >> c[i];
    }

    for (int i = 0; i <= n; ++i) {
        for (int ca = 0; ca <= nmax*abmax; ++ca) {
            for (int cb = 0; cb <= nmax*abmax; ++cb) {
                dp[i][ca][cb] = inf;
            }
        }
    }

    dp[0][0][0] = 0;
    for (int i = 0; i < n; ++i) {
        for (int ca = 0; ca <= nmax*abmax; ++ca) {
            for (int cb = 0; cb <= nmax*abmax; ++cb) {
                if (dp[i][ca][cb] == inf) continue;
                dp[i+1][ca][cb] = min(dp[i+1][ca][cb], dp[i][ca][cb]);
                dp[i+1][ca+a[i]][cb+b[i]] = min(dp[i+1][ca+a[i]][cb+b[i]], dp[i][ca][cb]+c[i]);
            }
        }
    }

    int ans = inf;
    for (int ca = 1; ca <= nmax*abmax; ++ca) {
        for (int cb = 1; cb <= nmax*abmax; ++cb) {
            if (ca*mb == cb*ma) ans = min(ans, dp[n][ca][cb]);
        }
    }

    cout << (ans == inf ? -1 : ans) << endl;
}


Measured memory_bytes: 25984
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <functional>
#include <cmath>

using namespace std;
using ll = long long;

int main() {
	int N, Y;
	cin >> N >> Y;
	int res10000 = -1, res5000 = -1, res1000 = -1;
	for (int a = 0; a <= N; ++a) {  
		for (int b = 0; b + a <= N; ++b) {  
			int c = N - a - b;  
			int total = 10000 * a + 5000 * b + 1000 * c;
			if (total == Y) {  
				res10000 = a;
				res5000 = b;
				res1000 = c;
				break;
			}
		}
	}

	cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include<string>
using namespace std;
int main(){
   int l[20]={};
   int n;
   cin>>n;
   int max,sum=0;
   max=-10000;
   for(int i=0; i<n; i++){
       cin>>l[i];
       if(max<l[i]){
           max=l[i];
        
       }
        
        sum=sum+l[i];  
        
        
       
       
    
    
   }
   sum=sum-max;
   if(sum<=max){
       cout<<"No"<<endl;
     
   }
   else {
       cout<<"Yes"<<endl;
   }
       
   
}
   
    




Measured memory_bytes: 256
from itertools import combinations


N, K, *XY = map(int, open(0).read().split())
X = sorted(XY[::2])
Y = sorted(XY[1::2])

ans = 10 ** 20
for x1, x2 in combinations(X, 2):
    for y1 in Y[:-1]:
        y2s = sorted(y for x, y in zip(*[iter(XY)] * 2) if x1 <= x <= x2 and y1 <= y)
        if len(y2s) < K:
            continue
        ans = min(ans, (x2 - x1) * (y2s[K - 1] - y1))
print(ans)



Measured memory_bytes: 9160
#include<stdio.h>

int main(void)
{
	int a;
	int b;

	scanf("%d",&a);
	scanf("%d",&b);
		
	if(a > b){
		printf("a > b\n");
	}                
	else if(a < b){  
		printf("a < b\n");
	}                
	else{            
		printf("a == b\n");
	}
	
	return 0;
}

Measured memory_bytes: 580
// ABC109
// D - Make Them Even

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_H = 500;
const int MAX_W = 500;

int H, W;
int a[MAX_H][MAX_W];

struct mv {
    int ya, xa, yb, xb;
};

void solve(vector<mv> &res) {
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W - 1; j++) {
            if (a[i][j] % 2 > 0) {
                res.push_back((mv){i + 1, j + 1, i + 1, j + 2});
                a[i][j]--;
                a[i][j + 1]++;
            }
        }
    }
    for (int i = 0; i < H - 1; i++) {
        if (a[i][W - 1] % 2 > 0) {
            res.push_back((mv){i + 1, W, i + 2, W});
            a[i][W - 1]--;
            a[i + 1][W - 1]++;
        }
    }
}

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a[i][j];
        }
    }

    vector<mv> ans;
    solve(ans);
    cout << ans.size() << endl;
    for (auto m : ans) {
        cout << m.ya << " " << m.xa << " " << m.yb << " " << m.xb << endl;
    }

    return 0;
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

class segtree{
public:
	static const int N=1<<17;
	ll dp[1<<18];
	segtree(){
		memset(dp,0,sizeof(dp));
	}
	void update(int k,ll v){
		k+=N-1;
		dp[k]+=v;
		while(k>0){
			k=(k-1)/2;
			dp[k]=dp[k*2+1]+dp[k*2+2];
		}
	}

	ll query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return 0;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		ll vl=query(a,b,k*2+1,l,mid);
		ll vr=query(a,b,k*2+2,mid,r);
		return vl+vr;
	}
};

int n,v,p;
ll m;
segtree seg;
ll a[100005];

int main(void){
	scanf("%d%lld%d%d",&n,&m,&v,&p);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		seg.update(i,a[i]);
	}
	int ans=p;
	for(int i=0;i<n-p;i++){
		if(v<=p){
			if(a[i]+m>=a[n-p]){
				ans++;
			}
		}else{
			ll rest=v-p-i;
			if(rest<=0){
				if(a[i]+m>=a[n-p]){
					ans++;
				}
			}else{
				ll rv=rest*m;
				ll su=(a[i]+m)*((n-p+1)-(i+1))-seg.query(i+1,n-p+1);
				//printf("%lld %lld\n",su,rv);
				if(a[i]+m>=a[n-p] && su>=rv){
					ans++;
				}
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<string> three = {
    "add",
    "a.c",
    "bbc",
};

vector<string> four = {
    "afgg",
    "afhh",
    "bbde",
    "ccde",
};

vector<string> five = {
    "ahhii", "ag..j", "bg..j", "b.ffe", "ccdde",
};

vector<string> six = {
    "aa.bbc", "de...c", "deff..", "..gghi", "j...hi", "jkk.ll",
};

vector<string> seven = {
    "a.jj.kk", "ai..ll.", ".i.mm.o", "b.h...o", "b.h..g.", ".ff..ge", "cc.dd.e",
};

int n;

// 4,5,6,7
void solve(int a, int b, int c, int d) {
    vector<string> ans(n, string(n, '.'));
    int id = 0;
    for(int i = 0; i < a; i++) {
        for(int y = id; y < id + 4; y++) {
            for(int x = id; x < id + 4; x++) {
                ans[y][x] = four[y - id][x - id];
            }
        }
        id += 4;
    }
    for(int i = 0; i < b; i++) {
        for(int y = id; y < id + 5; y++) {
            for(int x = id; x < id + 5; x++) {
                ans[y][x] = five[y - id][x - id];
            }
        }
        id += 5;
    }
    for(int i = 0; i < c; i++) {
        for(int y = id; y < id + 6; y++) {
            for(int x = id; x < id + 6; x++) {
                ans[y][x] = six[y - id][x - id];
            }
        }
        id += 6;
    }
    for(int i = 0; i < d; i++) {
        for(int y = id; y < id + 7; y++) {
            for(int x = id; x < id + 7; x++) {
                ans[y][x] = seven[y - id][x - id];
            }
        }
        id += 7;
    }
    for(int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    if(n <= 2) {
        cout << -1 << endl;
        return 0;
    }
    if(n == 3) {
        for(int i = 0; i < three.size(); i++) {
            cout << three[i] << endl;
        }
        return 0;
    }
    for(int i = 0; i * 7 <= n; i++) {
        for(int j = 0; j * 6 <= n; j++) {
            for(int k = 0; k * 5 <= n; k++) {
                int sum = i * 7 + j * 6 + k * 5;
                if(sum <= n && (n - sum) % 4 == 0) {
                    int l = (n - sum) / 4;
                    solve(l, k, j, i);
                    return 0;
                }
            }
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 2304
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+:---test
3
10 40 70
20 50 80
30 60 90
---+/
/+:---test
1
100 10 1
---+/
/+---test
7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 5 1
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;

  auto days = new long[3][N];
  foreach (ref day; days) readf(" %d %d %d ", &day[0], &day[1], &day[2]);

  auto dp = new long[3][N+1];

  foreach (i; 0..N) {
    foreach (j, score; days[i]) {
      auto jo = tuple(0, 1);
      if (j == 0) jo = tuple(1, 2);
      if (j == 1) jo = tuple(0, 2);
      dp[i+1][j] = max(dp[i][jo[0]], dp[i][jo[1]]) + score;
    }
  }

  long ans;
  dp[$-1][].each!(x => ans = ans.max(x));
  ans.writeln;
}


Measured memory_bytes: 7804
#include<stdio.h>
int main(void)
{
	int n,i,j,k,l;
	int minv;
	int d[1000],s[1000],P[1000][1000];
	int c=0;
	
	
	
scanf("%d",&n);
	
	for(i=0;i<n;i++){
	d[i]=0;
	s[i]=1000;
	for(j=0;j<n;j++){
		scanf("%d",&P[i][j]);
		
	}
	s[0]=0;
	}
	for(i=1;i<n;i++){
minv=1000;
	for(j=0;j<n;j++){
		if(s[j]<minv&&d[j]==0){
		minv=s[j];
		k=j;
	}
	}
	d[k]=1;
	for(l=0;l<n;l++){
		if(P[k][l]<s[l]&&P[k][l]!=-1&&d[l]==0){
		s[l]=P[k][l];
	}
	}
	}
	for(i=0;i<n;i++){
		c=c+s[i];
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 2128
#include <stdio.h>
#include <limits.h>
int FindMaxCrossingSubarray(int A[], int low, int mid, int high);
int FindMaximumSubarray(int A[], int low, int high);
int main(){
  int n;
  int i, j;
  scanf("%d", &n);
  int N[n];
  int R[n-1];
  int max=INT_MIN;
  int tmp;
  for(i=0; i<n; ++i){
	scanf("%d", &N[i]);
  }
  for(i=0; i<(n-1); ++i){
	R[i]=N[i+1]-N[i];
  }
  //sort
  max=FindMaximumSubarray(R, 0, n-2);
  //

  /* for(i=0; i<(n-1); ++i){ */
  /* 	printf("%d ", R[i]); */
  /* } */
  /* printf("\n"); */
  printf("%d\n", max);
  return 0;
}

int FindMaxCrossingSubarray(int A[], int low, int mid, int high){
  int sum=0;
  int leftsum=INT_MIN, rightsum=INT_MIN;
  int i;
  for(i=mid; i>=low; --i){
	sum+=A[i];
	if(sum>leftsum)
	  leftsum=sum;
  }
  sum=0;
  for(i=(mid+1); i<=high; ++i){
	sum+=A[i];
	if(sum>rightsum)
	  rightsum=sum;
  }
  return (leftsum+rightsum);
}
int FindMaximumSubarray(int A[], int low, int high){
  if(low==high)  
	return A[low];
  else{
	int mid;
	mid=(low+high)/2;
	int leftsum, rightsum, crosssum;
	leftsum=FindMaximumSubarray(A, low, mid);
	rightsum=FindMaximumSubarray(A, mid+1, high);
	crosssum=FindMaxCrossingSubarray(A, low, mid, high);
	if((leftsum>=rightsum)&&(leftsum>=crosssum))
	  return leftsum;
	else if((rightsum>=leftsum)&&(rightsum>=crosssum))
	  return rightsum;
	else
	  return crosssum;
  }
}



Measured memory_bytes: 3296
import sys
n = int(input())
arr = list(map(int, input().split()))

def print_arr(arr):
	for i in range(len(arr)):
		sys.stdout.write(str(arr[i]))
		if i != len(arr) - 1:
			sys.stdout.write(' ')
	print()

for i in range(n):
	key = arr[i]
	j = i - 1
	while j >= 0 and arr[j] > key:
		arr[j + 1] = arr[j]
		j = j - 1
	arr[j + 1] = key
	print_arr(arr)



Measured memory_bytes: 5984
/**
*    created: 10.05.2020 20:59:33
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int main() {
    string s, t;
    int ans=0;
    cin >> s >> t;
    rep(i,s.size()){
        if(s[i]!=t[i]){
            ans = 1;
            break;
        }
    }

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

Measured memory_bytes: 3596
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;

vector<int>G[200020];
int p[200020];
void dfs(int n, int pre) {
	for (auto nxt : G[n]) {
		if (nxt == pre)continue;
		p[nxt] += p[n];
		dfs(nxt, n);
	}
}
void solve() {
	int N, Q; cin >> N >> Q;
	REP(i, N - 1) {
		int u, v; cin >> u >> v;
		u--, v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	REP(i, Q) {
		int po, x; cin >> po >> x;
		po--;
		p[po] += x;
	}
	dfs(0,0);
	REP(i, N) {
		pe(p[i]);
	}cout << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


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

int F[102][102];

void
DFS (int Y, int X, int A)
{
  if (F[Y][X] != A)
    return;

  F[Y][X] = 7;

  DFS (Y - 1, X, A);
  DFS (Y, X + 1, A);
  DFS (Y + 1, X, A);
  DFS (Y, X - 1, A);
}

int
main ()
{
  int w, h;
  int xs, ys;
  int xg, yg;
  int n;
  int c, d, x, y;

  while (true)
    {
      cin >> w >> h;
      if (w == 0 && h == 0)
	break;
      cin >> xs >> ys;
      cin >> xg >> yg;
      cin >> n;

      for (int i = 0; i < n; i++)
	{
	  cin >> c >> d >> x >> y;
	  if (d == 0)
	    {
	      for (int a = 0; a < 4; a++)
		{
		  for (int b = 0; b < 2; b++)
		    {
		      F[y + b][x + a] = c;
		    }
		}

	    }
	  else
	    {
	      for (int a = 0; a < 2; a++)
		{
		  for (int b = 0; b < 4; b++)
		    {
		      F[y + b][x + a] = c;
		    }
		}
	    }

	}


      if (F[ys][xs] == 1 || F[ys][xs] == 2 || F[ys][xs] == 3
	  || F[ys][xs] == 4 || F[ys][xs] == 5)
	{
	  DFS (ys, xs, F[ys][xs]);
	}

      if (F[yg][xg] == F[ys][xs])
	{
	  cout << "OK" << endl;
	}
      else
	{
	  cout << "NG" << endl;
	}

    /*for (int y = 0; y < h; y++)
	{
	  for (int x = 0; x < w; x++)
	    {
	      cout << F[y][x];
	    }
         cout << endl;
	}*/

    }

  return 0;
}

Measured memory_bytes: 3064
import sys


input = sys.stdin.readline


def make_switch_set(i, s):
    if i == N:
        return [s]
    else:
        cs = s.copy()
        cs.add(i+1)
        return make_switch_set(i+1, s) + make_switch_set(i+1, cs)


def main():
    ans = 0
    for ss in switch_set:
        count = 0
        for switches, p in zip(S, P):
            match_num = len(ss & switches)
            if match_num % 2 == p:
                count += 1
        if count == M:
            ans += 1
    print(ans)


if __name__ == "__main__":
    N, M = map(int, input().split())
    S = []
    for _ in range(M):
        ipts = [int(ipt) for ipt in input().split()]
        S.append(set(ipts[1:]))
    P = [int(p) for p in input().split()]
    switch_set = make_switch_set(0, set())
    main()

Measured memory_bytes: 3444
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <set>
#include <string>
#include <iterator>
#include <queue>
#include <cmath>
#include <cassert>

using namespace std;

const int MAX_HW = 2010;

int main(int argc, char const *argv[])
{
    int H, W;
    vector<string> S;
    cin >> H >> W;
    S.resize(H);
    for (int h = 0; h < H; ++h) {
        cin >> S[h];
    }
    int rows[MAX_HW][MAX_HW]={0}, cols[MAX_HW][MAX_HW]={0};

    for (int h = 0; h < H; ++h) {
        int cnt = 0;
        int start = 0;
        for (int w = 0; w < W; ++w) {
            if (S[h][w]=='.') {
                cnt++;
                if (w == W-1) {
                    for (int i = start; i <= w; ++i) {
                        rows[h][i] = cnt;
                    }
                }
            }
            else {
                for (int i = start; i < w; ++i) {
                    rows[h][i] = cnt;
                }
                cnt = 0;
                start = w+1;
            }
        }
    }

    for (int w = 0; w < W; ++w) {
        int cnt = 0;
        int start = 0;
        for (int h = 0; h < H; ++h) {
            if (S[h][w]=='.') {
                cnt++;
                if (h == H-1) {
                    for (int i = start; i <= h; ++i) {
                        cols[i][w] = cnt;
                    }
                }
            }
            else {
                for (int i = start; i < h; ++i) {
                    cols[i][w] = cnt;
                }
                cnt = 0;
                start = h+1;
            }
        }
    }

    int ans = 0;
    for (int h = 0; h < H; ++h) {
        for (int w = 0; w < W; ++w) {
            if (S[h][w]=='#') continue;
            ans = max(ans, rows[h][w]+cols[h][w]-1);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 35968
X, K, D = map(int, input().split())

X = abs(X)
if X % D == 0:
    tmp = X // D
    if tmp >= K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(0)
        else:
            print(D)
else:
    tmp = X // D
    if tmp >= K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(X - X // D * D)
        else:
            print(abs(X - (X // D + 1) * D))

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

using namespace std;

int n, x[1000005], cnt[1000005];
bool np[1000005];

int gcd(int a, int b) {
	while (a) {
		b %= a;
		swap(a, b);
	}
	return b;
}

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", x + i);
		cnt[x[i]]++;
	}
	int g = x[0];
	for (int i = 1; i < n; i++)
		g = gcd(g, x[i]);
	bool ok = 1;
	for (int i = 2; i < 1000005; i++)
		if (!np[i]) {
			int tot = 0;
			for (int j = i; j < 1000005; j += i) {
				tot += cnt[j];
				np[j] = 1;
			}
			if (tot > 1)
				ok = 0;
		}
	if (ok)
		puts("pairwise coprime");
	else if (g == 1)
		puts("setwise coprime");
	else
		puts("not coprime");
}

Measured memory_bytes: 12472
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
    
    int a,b,k;
    cin >> a >> b >> k;

    int i = min(a,b);
    while(k > 0){
	if(a%i == 0 && b%i == 0)k--;
	i--;
    }
    P(i+1);
    return  0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       




        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var d = new Dictionary<char, long>();
            var w = Console.ReadLine();
            bool f = false;
            for (int i = 0; i < w.Length; i++)
            {
                if (d.ContainsKey(w[i])) d[w[i]]++;
                else d.Add(w[i], 1);
            }
            foreach(KeyValuePair<char,long> x in d)
            {
                if (x.Value % 2 != 0) f = true;
            }
            Console.WriteLine(f ? "No" : "Yes");
            

            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 13152
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n;	//??????????????°?????¨????????°
		int k = 3;	//?????????????????????????????°
		int x;	//??????????????????????????°?????¨????????°
		int year;	//???????????´??°
		n = in.nextInt();
		
		//??????????????????????????°x???????????¨??¨???
		while(n != 0){
			x = 0;
			year = 0;
			
			if(n<=k){
				x = (int)Math.pow(2,n-1);
			}else{
				int[] aryX = new int[n];	//??????????????????????????????????????°???????´?????????????
				for(int i=0; i<k; i++){
					aryX[i] = (int)Math.pow(2, i);
				}
				for(int i=k; i<n; i++){
					for(int j=0; j<k; j++){
						aryX[i] += aryX[i-j-1];
					}
				}
				x = aryX[n-1];
			}
			
			if(x%3650>0){
				year = x/3650 + 1;
			}else{
				year = x/3650;
			}
			
			System.out.println(year);
			n = in.nextInt();
		}
		
		in.close();
	}
}

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

using namespace std;

const long MOD = 1e9+7;

void solve()
{
	int H, W;
	cin >> H >> W;
	vector<string> maze(H);
	for (int i = 0; i < H; i++) cin >> maze[i];
	vector<long> dp(H*W);
	dp[0] = 1;
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++)
	{
		if (i+1<H && maze[i+1][j] != '#') dp[(i+1)*W+j] = (dp[(i+1)*W+j] + dp[i*W+j]) % MOD;
		if (j+1<W && maze[i][j+1] != '#') dp[i*W+j+1] = (dp[i*W+j+1] + dp[i*W+j]) % MOD;
	}

	cout << dp[H*W-1] << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 9088
fn main() {
    let stdin = std::io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf);
    let mut s = buf.split_whitespace();
    let n = s.next().unwrap();
    let k = s.next().unwrap();
    if n == k {
        println!("H");
    }
    else
    {
        println!("D");
    }
}

Measured memory_bytes: 4352
#include <iostream>
using namespace std;
#include <string>
int main(){
 string s[100],t[100];
 int N,M,score = 0,f_score = 0;
 cin >> N;
 for (int i = 0;i < N;i++){
   cin >> s[i];
 }
 cin >> M;
 for (int i = 0;i < M;i++){
   cin >> t[i];
 }


  for (int i = 0;i < N;i++){
    for (int j = 0;j < N ;j++){
      if (s[i] == s[j]){
        score ++;
      }
    }
    for (int j = 0;j < M ;j++){
      if (s[i] == t[j]){
        score --;
      }
    }
    if (score >= f_score){
      f_score = score;
    }
    score = 0;
  }
  if (f_score < 0){
    f_score = 0;
  }
  cout <<f_score <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  priority_queue<int> PQ;
  int n,m;
  int a;
  cin >> n >>m;
  REP(i,n){
    cin >> a;
    PQ.push(a);
  }
  while (m>0) {
    int b = PQ.top();
    PQ.pop();
    PQ.push(b/2);
    m--;
  }
  ll ans = 0;
  while(!PQ.empty()){
    int b = PQ.top();
    PQ.pop();
    ans+=b;
  }
  cout << ans << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define ull unsigned long long
#define FI(i,a,n) for(int i=a; i<=n; i++)
#define RFI(i,n,a) for(int i=n; i>=a; i--)
#define FLL(i,a,n) for(ll i=a; i<=n; i++)
#define RFLL(i,n,a) for(ll i=n; i>=a; i--)
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define pi pair<int, int>
#define GCD(a,b) __gcd(a,b)
#define MP make_pair
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define debug(x) cout << x << endl
#define MOD 1000000007
#define INF LLONG_MAX
#define PI 3.14159265359
using namespace std;

ll power(ll x, ll n)
{
  ll ans = 1;
  while(n)
  {
    if(n&1) ans = (ans*x)%MOD;
    n/=2, x = (x*x)%MOD;
  }
  return ans;
}

int main()
{
  fastio
  ll n, k;
  cin >> k;
  n=3;
  ll a[k+1]={};
  for(ll i=k/2+1; i<=k; i++) a[i]=1;
  for(ll i=k/2; i>=1; i--)
  {
    a[i] = power(k/i, n);
    for(ll j=2*i; j<=k; j+=i)
    {
      a[i] -= a[j];
      if(a[i]<0) a[i] += MOD;
    }
  }
  ll ans = 0;
  for(ll i=1; i<=k; i++) ans = (ans + i*a[i])%MOD;
  cout << ans ;



  return 0;
}




Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;

int main(){
    int n;
    while(cin >> n){
        vi v(n);
        rep(i,n) cin >> v[i];
        int ans = 0;
        priority_queue<int> q;
        rep(i,n){
            while(q.size() && q.top()>v[i]){
                ans++;
                q.pop();
            }
            if(!q.size() || q.top()<v[i]){
                q.push(v[i]);
            }
        }
        cout << ans+q.size() << endl;
    }
}

Measured memory_bytes: 2852
#include <stdio.h>

//関数プロトタイプ宣言
void moving_north(int *top, int *bottom, int *front, int *back);
void moving_east(int *top, int *bottom, int *right_side, int *left_side);
void rotate_right(int *front, int *back, int *right_side, int *left_side);

//ダイスの構造体
typedef struct{
	int top;
	int bottom;
	int right_side;
	int left_side;
	int front;
	int back;
}Dice;

int main(void)
{
	Dice dice1;
	Dice dice2;

	//iとjはループ変数、flagは2つのダイスが等しいか表す
	int i, j, flag;

	flag = 0;
	//ダイスの目を入力
	scanf("%d %d %d %d %d %d", 
		  &dice1.top, &dice1.front, &dice1.right_side, &dice1.left_side, &dice1.back, &dice1.bottom);
	scanf("%d %d %d %d %d %d", 
		  &dice2.top, &dice2.front, &dice2.right_side, &dice2.left_side, &dice2.back, &dice2.bottom);

	//dice1を基準とし、dice2を転がして各面を比較する
	for(i = 0; i < (4 * 4); i++){
		for(j = 0; j < 4; j++){
			//2つのダイスの目が全て等しければflagに1を代入
			if((dice1.top == dice2.top) && (dice1.bottom == dice2.bottom) && (dice1.front == dice2.front) &&
				(dice1.back == dice2.back) && (dice1.right_side == dice2.right_side) && (dice1.left_side == dice2.left_side)){
					flag = 1;
			}
			//ダイスの向きを変える
			rotate_right(&dice2.front, &dice2.back, &dice2.right_side, &dice2.left_side);
		}

		//ダイスを北側に転がし、ダイスが1周する度に東側に回転させる
		moving_north(&dice2.top, &dice2.bottom, &dice2.front, &dice2.back);
		if((i > 0) && (i % 4 == 0)){
			moving_east(&dice2.top, &dice2.bottom, &dice2.right_side, &dice2.left_side);
		}

		/* 無駄な繰り返しを省略
		if(flag){
			break;
		}
		*/
	}

	//結果を出力
	if(flag){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}

	return 0;
}

//北側に転がす関数
void moving_north(int *top, int *bottom, int *front, int *back)
{
	int temp;

	//各面の値をずらす
	temp = *top;
	*top = *front;
	*front = *bottom;
	*bottom = *back;
	*back = temp;
}

//東側に転がす関数
void moving_east(int *top, int *bottom, int *right_side, int *left_side)
{
	int temp;

	//各面の値をずらす
	temp = *top;
	*top = *left_side;
	*left_side = *bottom;
	*bottom = *right_side;
	*right_side = temp;
}

//上面と下面を軸とし右側へ回転する関数
void rotate_right(int *front, int *back, int *right_side, int *left_side)
{
	int temp;

	//各面の値をずらす
	temp = *front;
	*front = *left_side;
	*left_side = *back;
	*back = *right_side;
	*right_side = temp;
}


Measured memory_bytes: 2108
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LLINF 1<<63-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007
void swap(int* x,int* y){
  int tmp=*x;*x=*y;*y=tmp;
}

int main(){
  int N,ans=0;
  scanf("%d",&N);
  ans=180*(N-2);

  printf("%d\n",ans);
  return 0;
}


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

using namespace std;

int main(){
  int A, B;
  cin>> A >> B;
  if ( A>0 && B >0 || A<0 && B <0){
    if( A == 1 || B ==1)
      cout << A+B;
    else
      cout << A*B;
  }
  else{
    if( A < 0 && B > 0)
      cout << A + B;
    else if (A > 0 && B <0)
      cout << A - B;
    else if( A ==0 || B ==0)
    	cout<< max(A,B);
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
#include <bitset>

//#define _USE_MATH_DEFINES

#include <math.h>  /* M_PI */

//動的計画
//最小化問題
// template<class T>
// bool chmin(T& a,T b){if(a >  b) {a = b;return true;}return false;}
template<class T> 
bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX_INDEX = 100010;
ll dp[MAX_INDEX];
const ll INF = 1LL << 60;
int main(){
    
    int N;
    cin >> N;

    long long h[MAX_INDEX];
    for(int i=0;i < N;i++) cin >> h[i];

    //初期化
    //memset(dp,INF,sizeof(dp));
    for(int i = 0;i < MAX_INDEX;i++) dp[i] = INF;
    //memset(dp,INF,sizeof(dp));

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

    for(int i = 1;i< N;i++){

        chmin(dp[i],abs(h[i] - h[i - 1]) + dp[i - 1]);
         
        if(i > 1) chmin(dp[i],abs(h[i] - h[i - 2]) + dp[i - 2]);
        
        

    }

    //i→i + 1,i + 2

    cout << dp[N - 1] << endl;

    return 0;

}

Measured memory_bytes: 1792
#include<stdio.h>

int main(void){
    int n,m, i,j;
    int A[100][100]={},b[100]={},C[1000]={};

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

    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            scanf("%d",&A[i][j]);
        }
    }

    for(i = 0; i < m; i++){
        scanf("%d",&b[i]);
    }

    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            C[i] += A[i][j] * b[j];
        }
        printf("%d\n",C[i]);

                }
return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

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

    int A, B;
    cin >> A >> B;

    int ans = -1;
    for(int i = 1; i < 100000; ++i) {
        int a = static_cast<int>(static_cast<double>(i) * 0.08);
        int b = static_cast<int>(static_cast<double>(i) * 0.1);
        if(A == a && B == b) {
            ans = i;
            break;
        }
    }
    printf("%lld\n", ans);

    return 0;
}



Measured memory_bytes: 256
def getIntList(inp):
	return [int(_) for _ in inp]


from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs


def main(inputs):
	a,b,c=getIntList(inputs[0])
	
	if c-a-b<=0: print("No")
	else:
		if 4*a*b<(c-a-b)**2: print("Yes")
		else: print("No")
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)



Measured memory_bytes: 3064