akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <queue>

using namespace std;

#define ll long long
constexpr ll inf = 1e9+7;

int main () {
    int N;
    cin>>N;
    vector<ll> a(3*N);
    for (int n = 0; n < 3 * N; n++) cin>>a[n];

    vector<ll> front(N+1);
    vector<ll> back(N+1);
    priority_queue<ll, vector<ll>, greater<ll>> front_elem;
    priority_queue<ll> back_elem;
    ll front_sum = 0, back_sum = 0;
    for (int n = 0; n < N; n++) {
        front_sum += a[n];
        back_sum += a[3*N-1-n];
        front_elem.push(a[n]);
        back_elem.push(a[3*N-1-n]);
    }
    front[0] = front_sum;
    back[0] = back_sum;
    
    for (int k = 1; k <= N; k++) {
        front_elem.push(a[N+k-1]);
        back_elem.push(a[2*N-k]);

        ll front_mn = front_elem.top();
        front_elem.pop();
        ll back_mx = back_elem.top();
        back_elem.pop();

        front_sum += a[N+k-1] - front_mn;
        back_sum += a[2*N-k] - back_mx;
        front[k] = front_sum;
        back[k] = back_sum;
    }

    ll mx = numeric_limits<ll>::min();
    for (int k = 0; k <= N; k++) {
        mx = max(mx, front[k] - back[N-k]);
    }
    cout<<mx<<endl;

    return 0;
}

Measured memory_bytes: 5996
#include<iostream>
using namespace std;
int main(){
  int n,i,count,p;cin >> n;count = 0;
  for (i=1;i<=n;i++){
    cin >> p;
    if(i != p) count += 1;
  }
  cout << ((count==0 || count==2) ? "YES":"NO") << endl;
}

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

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

    long r, D, x_2000;

    cin >> r >> D >> x_2000;

    long sum_of_weight = x_2000;

    for (int i = 1; i <= 10; i++)
    {
        sum_of_weight = r * sum_of_weight - D;
        cout << sum_of_weight << '\n';
    }

    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    int n,k;
    cin>>n>>k;
    if((n+1)>=2*k)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    


    return 0;
}

Measured memory_bytes: 256
a,b,k=map(int, input().split())

s=0

for i in range(k):
    if s%2==0:
        if a%2!=0:
            a-=1
        b+=a//2
        a//=2
    else:
        if b%2!=0:
            b-=1
        a+=b//2
        b//=2
    s+=1

print(a,end=' ')
print(b)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long 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;
    }
 
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

map<string, mint> mp[101];
ll N;
string cl[4] = {"A", "G", "C", "T"};
mint dfs(ll n, string prev){
    mint res=0;
    if(n == N){
        return mint(1LL);
    }
    if(mp[n].count(prev)){
        return mp[n][prev];
    }
    rep(i,4){
        if(prev.substr(1,2) == "AG" && cl[i] == "C")continue;
        if(prev.substr(1,2) == "AC" && cl[i] == "G")continue;
        if(prev.substr(1,2) == "GA" && cl[i] == "C")continue;
        if(prev[0] == 'A' && prev[2] == 'G' && cl[i] == "C")continue;
        if(prev[0] == 'A' && prev[1] == 'G' && cl[i] == "C")continue;
        res += dfs(n+1, prev.substr(1,2) + cl[i]);
    }
    mp[n][prev] = res;
    return res;
}

int main(){
    cin >> N;
    mint ans = dfs(0,"TTT");
    cout << ans << endl;
}

Measured memory_bytes: 3984
questionNum = int(input())
minPoint = 100
sumPoint = 0
for i in range(questionNum):
  inputPoint = int(input())
  if inputPoint < minPoint and inputPoint % 10 != 0:
    minPoint = inputPoint
  sumPoint += inputPoint
if minPoint == 100:
  ans = sumPoint % 10
elif sumPoint % 10 == 0:
  ans = sumPoint - minPoint
else:
  ans = sumPoint
print(ans)

Measured memory_bytes: 3064
# from pprint import pprint
# import math
# import collections
import numpy as np
import itertools

# n = int(input())
h, w, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

white = '.'
black = '#'

c = []
c2 = [[0] * w for h in range(h)]
for i in range(h):
    c.append(list(input()))

for i in range(h):
    for j in range(w):
        c2[i][j] = 1 if c[i][j] == black else 0

nc = np.array(c2)

black_total = np.sum(c2)

h_blacks = list(np.sum(c2, axis=1))
w_blacks = list(np.sum(c2, axis=0))

# print(h_blacks)
# print(w_blacks)

import copy

# bit全探索
pattern = []
cnt = 0
for _h in list(itertools.product([0, 1], repeat=h)):
    for _w in list(itertools.product([0, 1], repeat=w)):
        pattern.append((_h, _w))

cnt = 0
for p in pattern:
    # print(p)
    test_c = copy.deepcopy(c2)
    for i, ih in enumerate(p[0]):
        for j, jw in enumerate(p[1]):
            if ih == 0 or jw == 0:
                test_c[i][j] = 0
    sum = np.array(test_c).sum()
    # print(sum)

    if sum == k:
        cnt += 1

print(cnt)


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

using namespace std;

int main(){
  int n;
  long long A;
  cin >> n >> A;
  long long x[n];
  for(auto& y:x){
    cin >> y;
    y-=A;
  }
  vector<map<long long,long long>> dp(n+1);
  dp[0][0] = 1;
  for(int i=0;i<n;i++){
    for(const auto& y:dp[i]){
      dp[i+1][y.first]+=y.second;
      dp[i+1][y.first+x[i]] += y.second;
    }
  }
  long long ret = 0;
  cout << dp[n][0]-1 << endl;
  return 0;
}


Measured memory_bytes: 1664
#!/usr/bin/env python3

import sys

def solve(r):
    if r < 1200:
        print('ABC')
    elif r < 2800:
        print('ARC')
    else:
        print('AGC')

def readQuestion():
    ws = sys.stdin.readline().strip().split()
    r = int(ws[0])
    return (r,)

def main():
    solve(*readQuestion())

main()


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

int calc_digit(long long N)
{
    if (N == 0) return 1;

    int res = 0;
    while (N) {
        res++;
        N /= 10;
    }
    return res;
}

int main()
{
    long long N;
    cin >> N;
    int res = (1 << 29);
    for (long long A = 1; A * A <= N; A++)
    {
        if (N % A == 0) {
            long long B = N / A;
            int F = max(calc_digit(A), calc_digit(B));
            res = min(res, F);
        }
    }
    cout << res << endl;
}

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

using ll = long long;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> mp(n);
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int k = 0; k < n; k++) {
            if (s[k] == '1') {
                mp[i].emplace_back(k);
            }
        }
    }
    int ans = -1;
    for (int i = 0; i < n; i++) {
        int mx = 1;
        vector<int> num(n, -1);
        num[i] = 1;
        queue<int> q;
        q.emplace(i);
        while (!q.empty()) {
            int front = q.front();
            q.pop();
            int new_val = num[front] + 1;
            for (auto e: mp[front]) {
                if (num[e] < 0) {
                    num[e] = new_val;
                    q.emplace(e);
                    mx = max(mx, new_val);
                } else if (num[e] > 0 && (num[e] - new_val) % 2 != 0) {
                    mx = -1;
                    queue<int>().swap(q);
                    break;
                }
            }
        }
        ans = max(ans, mx);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
import math
a, b, x = map(int, input().split())
if x == a*a*b:
  print(0)
  exit()
if x/a/a*2>=b:
  h = x/a/a*2-b
  rad = math.atan(a/(b-h))
else:
  rad = math.atan(x/a*2/b/b)
print(90-math.degrees(rad))

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

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

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    
    int a,b;
    scanf("%d%d",&a,&b);
    if(b==1){
        printf("0");
        return 0;
    }
    int sum =a;
    int cnt =1;
    while(sum<b){
        sum+=a-1;
        cnt++;
    }
    printf("%d",cnt);
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll>
#define sqr(x) (x)*(x)
#define endl "\n"
#define mod 1000000007

ll bigmod(ll a, ll p, ll m){
    ll res=1;
    ll x=a;
    while(p){
        if(p&1){
            res=(res*x)%m;
        }
        x=(x*x)%m;
        p=p>>1;
    }
    return res;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(),cout.tie();
    ll n,k;
    cin>>n>>k;
    ll ans[k],sum=0;
    for(int i=k;i>=1;i--){
        ll x=k/i;
        ans[i]=bigmod(x,n,mod);
        for(int j=2*i;j<=k;j+=i){
            ans[i]=(ans[i]-ans[j]+mod)%mod;
        }
        sum=(sum+(ans[i]*i)%mod)%mod;
    }
    cout<<sum<<endl;
    return 0;
}



Measured memory_bytes: 4420
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f

int main()
{
    int n,x[110];
    int ans=maxn;
    while(~scanf("%d",&n))
    {
        ans=maxn;
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&x[i]);
        }
        for(int i=1;i<=100;i++)
        {
            int sum=0;
            for(int j=1;j<=n;j++)
            {
                sum+=(x[j]-i)*(x[j]-i);
            }
            ans=min(sum,ans);
        }
        printf("%d\n",ans);
    }
}


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

using namespace std;

typedef long long ll;

#define smax(a,b) a=min(a,b);

int main()
{
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  smax(b,2*a);
  smax(c,2*b);
  smax(d,2*c);
  ll h;
  cin >> h;
  cout << (h/2)*d+(h%2)*c;
}


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

namespace ConsoleApp1 {
    public class Class1 {
        static void Main(string[] args) {
            var LR = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var N = LR[0];
            var M = LR[1];

            var X = Console.ReadLine().Split(' ').Select(long.Parse).ToList();
            X.Sort();
            var Diff = new List<long>();
            for (var i = 0; i < M - 1; i++) Diff.Add(Math.Abs(X[i] - X[i + 1]));
            Diff.Sort();
            if (Diff.Count < N) {
                Console.Write(0);
            } else {
                Diff.RemoveRange(Diff.Count - N + 1, N - 1);
                Console.Write(Diff.Sum());
            }
        }
    }
}

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

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
const int MAXN=100000 +10, oo= 1<<29;

int b[MAXN], n,m, f[MAXN], cnt[17];
bool vis[MAXN];

int DP(int s);

int main(){
//	freopen("input.txt","rt",stdin);
//	freopen("output.txt","wt",stdout);
	scanf("%d", &n );
	for (int i=1, u,v,a; i<n; i++){
		scanf("%d%d%d", &u, &v, &a);
		b[u] ^= a;
		b[v] ^= a;
	}
	for (int i=0; i<n; i++) cnt[b[i]]++;
	int ans=0, inista=0;
	for(int i=1; i<16; i++){
			
		ans += cnt[i]/ 2;
		cnt[i] %= 2;
		inista |= cnt[i]*(1<<i);
		#ifdef che
		if ( cnt[i]) debug("cnt[%d] = %d\n", i, cnt[i]);
		#endif
	}
	#ifdef che
	debug("same contrad ans= %d\tinitial state =%d\n", ans,inista);
	#endif
	ans += DP(inista);
	printf("%d\n" , ans);
	return 0;
}

int DP(int s){
	if ( s==0) return 0;
	if ( vis[s]) return f[s];
	vis[s]= true; f[s] = oo;
	for (int i=0; i<16; i++)
		for (int j=i+1; j<16 ;j++)
			if ( s&(1<<i) && s&(1<<j) ){
				int rst= s^(1<<i)^(1<<j), nw= 1<<(i^j);
				if ( rst&nw) f[s]= min( f[s], DP(rst^nw)+2);
					else f[s]= min(f[s], DP(rst^nw)+1);
			}
	
	return f[s];
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int L = scan.nextInt();
		String[] S = new String[N];
		String tmp = "";
		String blank = scan.nextLine();
		
		for(int i = 0; i < N; i++) {
			S[i] = scan.nextLine();
		}
		Arrays.sort(S);
		
		for(int i = 0; i < N; i++) {
			tmp += S[i];
		}
		
		System.out.print(tmp);
		
		scan.close();
	}

}


Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	VV info(n);
	priority_queue<int> pq;
	rep(i, n) {
		int m;
		cin >> m;
		rep(j, m) {
			int a;
			cin >> a;
			info[i].push_back(a);
		}
	}
	ll ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		rep(j, info[i].size()) {
			pq.push(info[i][j]);
		}
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll a;
    cin >> a;
    string s;
    cin >> s;
    if(a >= 3200) cout << s;
    else cout << "red";

    return 0;
}

Measured memory_bytes: 3612
/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  cin >> n >> m;
  vector<int>a(m);
  rep(i,m) cin >> a.at(i);
  int sum=0;
  rep(i,m) sum+= a.at(i);
  
  if(n >=sum) cout<<n-sum<<endl;
  else cout<<"-1"<<endl;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
  fio();
  LL n,k; cin>>n>>k;
  vector<LL> v(n);
  forn(i,n) cin>>v[i];
  sort(all(v));
  LL su = 0;
  forn(i,k){
  	su+=v[i];	
  }
  cout<<su<<endl;
  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
using namespace std;


int main() {
	
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		
		set<string> ans;
		string str;
		cin >> str;
		for(int j=1;j<str.length();j++)
		{
			string a = str.substr(0,j);
			string b = str.substr(j,str.length()-j);
			string ra = a;
			reverse(ra.begin(),ra.end());
			string rb = b;
			reverse(rb.begin(),rb.end());
			
			ans.insert( a+b );
			ans.insert( ra+b );
			ans.insert( a+rb );
			ans.insert( ra+rb );

			ans.insert( b+a );
			ans.insert( rb+a );
			ans.insert( b+ra );
			ans.insert( rb+ra );
		}
		cout << ans.size() << endl;
	}

	// your code goes here
	return 0;
}

Measured memory_bytes: 1288
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	int H, W;
	cin >> H >> W;
	vector<vector<bool>>F(H, vector<bool>(W, false));
	for (int h = 0; h < H; ++h) {
		string S;
		cin >> S;
		for (int w = 0; w < W; ++w) {
			if (S[w] == '#') {
				F[h][w] = true;
			}
		}
	}
	vector<bool> HH(H, true), WW(W, true);
	for (int w = 0; w < W; ++w) {
		bool flag = false;
		for (int h = 0; h < H; ++h) {
			if (F[h][w] == true) {
				flag = true;
				break;
			}
		}
		if (flag == false) {
			WW[w] = false;
		}
	}
	for (int h = 0; h < H; ++h) {
		bool flag = false;
		for (int w = 0; w < W; ++w) {
			if (F[h][w] == true) {
				flag = true;
				break;
			}
		}
		if (flag == false) {
			HH[h] = false;
		}
	}
	for (int h = 0; h < H; ++h) {
		if (HH[h] == false)continue;
		for (int w = 0; w < W; ++w) {
			if (WW[w] == false)continue;
			if (F[h][w] == true) {
				cout << "#";
			}
			else {
				cout << ".";
			}
		}
		cout << endl;
	}
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


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

using namespace std;

int main() {
    char n;
    cin >> n;
    if (n=='A') {
        cout << 'T' << endl;
    }else if (n=='T') {
        cout << 'A' << endl;
    }else if (n=='G') {
        cout << 'C' << endl;
    }else if (n=='C') {
        cout << 'G' << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N, X; cin >> N >> X;
    vec x(N); readvec(x);

    vec sumx(N + 1);
    sumx[0] = 0;
    REP(i, N) sumx[i + 1] = sumx[i] + x[i];

    int ans = INF;
    IFOR(k, 1, N + 1){
        int tmp = (N + k) * X;
        int n = N / k + min(1LL, N % k);
        tmp += (sumx[N] - sumx[N - k]) * 5;
        FOR(i, 2, n + 1){
            int y = sumx[N - k * (i - 1)] - sumx[max(0LL, N - k * i)];
            if((double)(ans - tmp) / (double)(y) < 2 * i + 1){
                tmp = INF;
                break;
            }
            tmp += y * (2 * i + 1);
        }
        ans = min(tmp, ans);
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 3328
#include <bits/stdc++.h> 
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
using namespace std;
typedef long long ll;
const int mods = 998244353;
const int maxn = 2e5+10;
const int N = 1e6+10;
const int E = 1e6+10;  
ll n,m,k;

int main(){
	cin>>n>>m;
	ll ans = 0 ;
	ans+=((n-1)*n)/2;
	ans+=((m-1)*m)/2;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
fun num(input: String) : Long {
    var i = 0L
    var r = 0L
    var prev = ' '
    input.forEach {
        if (prev != it) {
            r += i / 2
            i = 1
        } else {
            i++
        }
        prev = it
    }
    r += i / 2
    return r
}

fun main(args: Array<String>) {
    val input = readLine()!!
    val k = readLine()!!.toLong()

    val one = num(input)
    val two = num(input.repeat(2))

    val allSame = input.all { it == input.first() }
    if (allSame) {
        println(input.length * k / 2)
    } else {
        println((two - one) * (k - 1) + one)
    }
}



Measured memory_bytes: 33784
def getInts():
  return map(int, raw_input().split())

(d, n) = getInts()
t = [input() for i in range(d)]
a = [0 for i in range(n)]
b = [0 for i in range(n)]
c = [0 for i in range(n)]

for i in range(n):
  (a[i], b[i], c[i]) = getInts()

memo = [[-1 for i in range(n)] for j in range(d)]

def solve(day, prev):
  if day == d:
    return 0

  if memo[day][prev] != -1:
    return memo[day][prev]

  ret = 0
  for i in range(n):
    if a[i] <= t[day] and t[day] <= b[i]:
      pt = 0
      if day != 0:
        pt = abs(c[i] - c[prev])
      ret = max(ret, pt + solve(day + 1, i))

  memo[day][prev] = ret
  return ret

print solve(0, 0)

Measured memory_bytes: 5056
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <ctime>
#define _repargs(_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(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 1LL << 62
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

const double pi = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    double L;
    cin >> N >> L;
    vector<double> T(N);
    rep(i, N) cin >> T[i];
    
    pair<double, double> ans;
    
    rep(i, N) rep(j, i + 1, N) {
        ans.first += cos(pi / L * (T[i] + T[j])) * (N - j + i - 1);
        ans.second += sin(pi / L * (T[i] + T[j])) * (N - j + i - 1);
        ans.first += cos(pi / L * (T[i] + T[j] - L)) * (j - i - 1);
        ans.second += sin(pi / L * (T[i] + T[j] - L)) * (j - i - 1);
    }
    ans.first *= 6.0 / N / (N - 1) / (N - 2);
    ans.second *= 6.0 / N / (N - 1) / (N - 2);
    
    cout << fixed << setprecision(10) << ans.first << " " << ans.second << endl;
    
    return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
from copy import *

N = int(input())
a, b = list(map(int, input().split())), list(map(int, input().split()))
m, ans = 2**29, 0
for i in range(1, 30)[::-1]:
    a = [x % m for x in a]
    b = [y % m for y in b]
    m //= 2
    a.sort(reverse = 1)
    b.sort()
    f, l1, r1, l2 = 0, 0, 0, 0
    for x in a:
        while l1 < N and x+b[l1] < m:
            l1 += 1
        while r1 < N and x+b[r1] < 2*m:
            r1 += 1
        while l2 < N and x+b[l2] < 3*m:
            l2 += 1
        f += N-l2+r1-l1
    ans += m*(f&1)
print(ans)


Measured memory_bytes: 137924
#include <iostream>    // cin, cout
#include <string>    // string, stoi, to_string
#include <algorithm>    // sort, lower_bound, heap, min, next_permutation 
#include <functional>    // greater, less
#include <vector>    // vector
#include <stack>    // stack
#include <queue>    // queue
#include <list>    // list
#include <map>    // map
#include <set>    // set
#include <tuple>    // tuple
#include <bitset>    // bitset
#include <cstdio>  // fopen, printf, scanf, puts
#include <cmath>    // sin, exp, log, pow, sqrt
#include <iomanip>    // setfill, setbase
#include <ctime>    // clock

using namespace std;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30));
const long long linf = (1LL<<60);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}


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

using namespace std;
int main(void){
    long n;
    cin >> n;
    vector<long> a(n + 1);
    vector<long> b(n);
    
    for(int i = 0;i < n + 1;i++){
          cin >> a[i];
    }
    for(int i = 0;i < n;i++){
          cin >> b[i];
    }
    long ans = 0;
    for(int i = 0;i < n;i++){
          int t = min(a[i],b[i]);
          ans += t;
          b[i] -= t;
          t = min(a[i + 1],b[i]);
          ans += t;
          a[i + 1] -= t;
          
    }
    cout << ans << endl;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	string S; cin >> S;
	map<char, int> occ;
	ll ans = 1;
	R0F(i, S.size()) {
		occ[S[i]]++;
		ans += S.size() - i - occ[S[i]];
	}
	print(ans);
}

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

typedef long long ll;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
  int n;
  cin >> n;
  
  cout << ((n + 1)/2)/(double)n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
int main(){
    ll n, ans = -pow(10, 9), check, count;
    cin >> n;
    bool F[n][10];
    ll P[n][10];
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            cin >> F[i][j]; 
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<11;j++){
            cin >> P[i][j]; 
        }
    }
    for(int k=1;k<1<<10;k++){
        check = 0;
        for(int i=0;i<n;i++){
            count = 0;
            for(int j=0;j<10;j++){
                if((k>>j) & F[i][j]){
                    count++;
                }
            }          			
            check += P[i][count];
        }
        ans = max(ans, check);
    }
    cout << ans << endl;
    return 0;
 
}


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

#define LL long long
#define pii pair<int,int>
using namespace std;
const int inf = 2147483647;
const int N = 200001;

int _max(int x, int y) {return x > y ? x : y;}
int _min(int x, int y) {return x < y ? x : y;}
inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x * f;
}
void put(int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x >= 10) put(x / 10);
	putchar(x % 10 + '0');
}

int p[N], s[N];
struct seg {
	int cnt, lc[N << 2], rc[N << 2], mx[N << 2], mn[N << 2];
	
	void bt(int n) {
		for(cnt = 1; cnt <= n; cnt <<= 1);
		for(int i = 1; i <= n; i++) mx[i + cnt] = mn[i + cnt] = p[i];
		for(int i = cnt; i >= 1; i--) mx[i] = _max(mx[i << 1], mx[i << 1 | 1]), mn[i] = _min(mn[i << 1], mn[i << 1 | 1]);
	}
	
	pii query(int l, int r) {
		int mxx = 0, mnn = 999999999;
		for(l += cnt - 1, r += cnt + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
			if(~l & 1) mxx = _max(mxx, mx[l ^ 1]), mnn = _min(mnn, mn[l ^ 1]);
			if( r & 1) mxx = _max(mxx, mx[r ^ 1]), mnn = _min(mnn, mn[r ^ 1]); 
		} return pii{mnn, mxx};
	}
} t;

int main() {
	int n = read(), k = read();
	for(int i = 1; i <= n; i++) p[i] = read();
	for(int i = 2; i <= n; i++) {
		if(p[i] > p[i - 1]) s[i] = s[i - 1] + 1;
		else s[i] = 0;
	} int ans = 1; t.bt(n); bool bk = 0;
	for(int i = 1; i <= n - k; i++) {
		pii tmp = t.query(i, i + k);
		if(tmp.first == p[i] && tmp.second == p[i + k]);
		else if(s[i + k] >= k - 1 && bk);
		else ans++;
		if(s[i + k] >= k - 1) bk = 1;
	} put(ans), puts("");
	return 0;
}


Measured memory_bytes: 7936
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		try(Scanner sc=new Scanner(System.in)){
			int x=sc.nextInt();
			x/=100;
			String str="ai1333";
			for(int i=0; i<x; i++) {
				str+="3";
			}
			System.out.println(str);

			
		}
	}
} 


Measured memory_bytes: 26228
N,K = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(N)]
ab.sort(key = lambda x:x[0])

beg = 0
for i in range(N):
    beg += ab[i][1]
    if beg >= K:
        print(ab[i][0])
        exit()

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

int main()
{
    int n,k;
    cin>>n>>k;
    vector<int>a(n);
    vector<bool>v(k+1);
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<=k;i++)
    {
        for(int j : a)
        {
            if(i>=j && !v[i-j])
                v[i]=true;
        }
    }
    cout<<(v[k] ? "First" : "Second");
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;
constexpr int MOD = 1000000007;

int mod(int x){
	return x % MOD;
}

int main(void)
{
    IOS
    int n; cin >> n;
    vector<bitset<20>> bs;
    REP(i,n) {
        int x;
        cin >> x;
        bitset<20> b(x);
        bs.emplace_back(b);
    }
    bitset<20> tmp = bs[0];
    int l = 0;
    int r = 1;
    ll ans = n;
    while(r != n) {
    //cerr << "any" << l << " " << r <<endl;
        bitset<20> b = tmp & bs[r];
        //cerr << b << endl;
        if (b.any()) {
            tmp ^= bs[l];
            l++;
        } else {
            ans += r-l;
            tmp |= bs[r];
            r++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>

using namespace std;
typedef pair<int, int> P;

int n;
int s[10], t[10], u[10];
const int N = 12*60*60;
vector<P> cantime;
int cnt[10];

int encode(int h, int m, int s)
{
	return (h/5) * 3600 + m * 60 + s;
}

string decode(int t)
{
	int h, m, s;
	s = t % 60, t /= 60;
	m = t % 60, t /= 60;
	h = t;
	
	char buf[15];
	sprintf(buf, "%02d:%02d:%02d", h, m, s);
	return buf;
}

int main(void)
{
	while(1){
		cin >> n;
		if(n == 0) break;
		
		for(int i = 0; i < n; i++) cin >> s[i] >> t[i] >> u[i];
		
		cantime.clear();
		int S, T, U;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < 60; j++){
				S = (s[i]+j) % 60;
				T = (t[i]+j) % 60;
				U = (u[i]+j) % 60;
				if(S % 5 == T / 12)
					cantime.push_back( make_pair(encode(S, T, U), i) );
				if(T % 5 == S / 12)
					cantime.push_back( make_pair(encode(T, S, U), i) );
				if(S % 5 == U / 12)
					cantime.push_back( make_pair(encode(S, U, T), i) );
				if(U % 5 == S / 12)
					cantime.push_back( make_pair(encode(U, S, T), i) );
				if(T % 5 == U / 12)
					cantime.push_back( make_pair(encode(T, U, S), i) );
				if(U % 5 == T / 12)
					cantime.push_back( make_pair(encode(U, T, S), i) );
			}
		}
		sort(cantime.begin(), cantime.end());
		
		/*for(int i = 0; i < cantime.size(); i++) 
			cout << decode(cantime[i].first) << "(" << cantime[i].second <<") ";
		cout << endl;*/
		
		int ans = N+1;
		int ans_i, ans_j;
		
		
		int i = 0, j = -1;
		bool flag;
		for(int z = 0; z < n; z++) cnt[z] = 0;
		
		while(1){
			while(1){
				flag = false;
				for(int z = 0; z < n; z++) if(cnt[z] == 0) flag = true;
				if(!flag) break;
				j++;
				if(j >= cantime.size()) goto end;
				cnt[cantime[j].second]++;
				
			}
			if(ans > cantime[j].first - cantime[i].first){
				ans_i = i;
				ans_j = j;
				ans = cantime[j].first - cantime[i].first;
			}
			cnt[cantime[i].second]--;
			i++;
		}
		
		end:;
		cout << decode(cantime[ans_i].first) << " " << decode(cantime[ans_j].first) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3100
use std::io::*;
use std::str::FromStr;
use std::cmp;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>() -> (T, S) {
    let a = read();
    let b = read();
    (a, b)
}


fn main() {
    let n:u32 = read();
    let a:Vec<u32> = (0..n).map(|_|read()).collect();
    let max_val = a.iter().fold(0, |acc, x| cmp::max(acc, *x));
    let mut is_ok = vec![0;(max_val+1) as usize];
    for a_val in a.iter() {
        for time in 1.. {
            let a_time = a_val * time;
            if a_time > max_val {
                break;
            }
            is_ok[a_time as usize] += 1;
        }
    }

    let ans:u32 = a.iter().map(|a_val|if is_ok[*a_val as usize] < 2{1}else{0}).sum();
    println!("{}", ans);
}


Measured memory_bytes: 6604
var i:longint;
    a:array[0..100]of int64;
    x,ans,max:int64;
    k,c:longint;
begin
  for i:=1 to 3 do
  begin
    read(a[i]);
    if a[i]>max then
    begin
      max:=a[i];
      c:=i;
    end;
  end;
  read(k);
  x:=1;
  for i:=1 to k do
  x:=x*2;
  for i:=1 to 3 do
  if c<>i then inc(ans,a[i]);
  inc(ans,a[c]*x);
  writeln(ans);
end.

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

using namespace std;

#define F first
#define S second
#define MAX_N 1e5+10
#define inf 1000000

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vbl;

int main() {
  int n;
  cin >> n;
  int h[n+1], dp[n+1];
  for (int i = 1 ; i <= n ; i++) {
    cin >> h[i];
    dp[i] = inf;
  }
  dp[1] = 0; dp[2] = abs(h[1]-h[2]);
  for (int i = 3 ; i <= n ; i++) {
    dp[i] = min(dp[i-2]+abs(h[i-2]-h[i]),dp[i-1]+abs(h[i-1]-h[i]));
  }

  cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <list>
#include <utility>

using namespace std;

typedef pair<double, double> point;

void koch(list<point> &P) {
  for (list<point>::iterator iter = P.begin(), prev = P.end(); iter != P.end(); prev = iter, ++iter) {
    double x0 = prev->first, y0 = prev->second, x1 = iter->first, y1 = iter->second;
    if (prev != P.end()) {
      // cout << "(" << x0 << "," << y0 << ") (" << x1 << "," << y1 << ")" << endl;

      double xs = x0 + (x1 - x0) / 3.;
      double ys = y0 + (y1 - y0) / 3.;
      double xt = x0 + (x1 - x0) * 2. / 3.;
      double yt = y0 + (y1 - y0) * 2. / 3.;
      double xu = xs + (xt - xs) / 2. - (yt - ys) * sqrt(3.) / 2.;
      double yu = ys + (xt - xs) * sqrt(3.) / 2. + (yt - ys) / 2.;
      P.insert(iter, make_pair(xs, ys));
      P.insert(iter, make_pair(xu, yu));
      P.insert(iter, make_pair(xt, yt));
    }
  }
}

int main() {
  list<point> P;

  P.push_back(make_pair(0., 0.));
  P.push_back(make_pair(100., 0.));

  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    koch(P);
  }
  for (list<point>::iterator iter = P.begin(); iter != P.end(); iter++) {
    printf("%0.8lf %0.8lf\n", iter->first, iter->second);
  }
}


Measured memory_bytes: 2944
def bubblesort(array):
    flag = True
    res = 0
    while flag:
        flag = False
        for i in range(len(array)-1, 0, -1):
            if array[i] < array[i-1]:
                array[i], array[i-1] = array[i-1], array[i]
                res += 1
                flag = True
    return (array, res)
     
int(input())
arr, c = bubblesort([int(i) for i in input().split()])
print(*arr,sep=' ')
print(c)


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

using namespace std;

#define int long long

void solve() {
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < s.size() / 2; ++i) {
        if (s[i] != s[s.size() - i - 1]) ++cnt;
    }
    cout << cnt;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX(x,y) (x)>(y)?(x):(y)

int main(void) {
	int a,b,c,d;
	
	scanf("%d %d %d %d",&a,&b,&c,&d);
	
	printf("%d\n",MAX(a*b,c*d));
	
	return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll INFL = 1e18;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////

int main(){
    int n,m;
    cin >> n >> m;
    long long N = 1, M = 1;
    for (int i = 1;i <= m;i++){
        M *= i;
        M %= mod;
    }
    for (int i = 1;i <= n;i++){
        N *= i;
        N %= mod;
    }
    if (abs(m-n) >= 2){
        cout << 0 << endl;
    }
    else if (abs(m-n) == 1){
        cout << M*N%mod<< endl;
        return 0;
    } else {
        cout << 2*M*N%mod << endl;
        return 0;
    }
}

Measured memory_bytes: 3596
from collections import Counter

n = int(input())
count = Counter(input().split())
ans = 0
for v, c in count.items():
    ans += int(v) * c
for i in range(int(input())):
    b, c = input().split()
    if b in count:
        ans -= count.get(b, 0) * int(b)
        prev = count.get(c, 0)
        count[c] = count[b] + count.get(c, 0)
        count[b] = 0
        ans += (count.get(c, 0) - prev) * int(c)
    print(ans)

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

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

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];
  int cnt = 0;
  vint ans;
  map<int, int> mp;
  rep(i, n) {
    int j = n-1-i;
    bool f = mp[a[i]] == 0;
    mp[a[i]]++;
    if(f) ++cnt;
    else if(mp[a[i]] == 0) --cnt;
    bool g = mp[a[j]] == 0;
    mp[a[j]]--;
    if(g) ++cnt;
    else if(mp[a[j]] == 0) --cnt;
    if(cnt == 0) ans.push_back(i);
    //cout<<i<<" "<<cnt<<endl;
  }
  int sz = ans.size();
  rep(i, sz) cout << ans[i]+1 << " \n"[i==sz-1];

  return 0;
}



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

int main() {
    int n, temp;
    cin >> n;
    set<int> st;
    rep(i, n) {
        cin >> temp;
        if(st.find(temp) == st.end()) st.insert(temp);
        else st.erase(temp);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 4864
import java.util.Scanner;

public class Main{

	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a <= 9 && a >= 1 && b <= 9 && b >= 1 ){
			System.out.println(a*b);
		} else {
			System.out.println(-1);
		}
		
	}
}

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

using namespace std;

int main()
{
    int a[4], b[2];
    for (int i = 0; i < 4; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < 2; i++) {
        cin >> b[i];
    }

    sort(a, a + 4, greater<int>());
    sort(b, b + 2, greater<int>());

    cout << a[0] + a[1] + a[2] + b[0] << endl;
    return 0;
}

Measured memory_bytes: 3148
#Big Array
N, K = map(int, input().split())
a = [0]*(N)
b = [0]*(N)
R = [0]*(10**5+1)
ans = 0
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(N):
    R[a[i]] = R[a[i]] + b[i]
j = 0
while K > 0:
    K = K - R[j]
    ans = ans + 1
    j = j + 1
print(ans-1)

Measured memory_bytes: 13676
N,A,B = map(int,input().split())
S = input()
a = 0
b = 0
for s in S:
    if s == 'a':
        a += 1
        print("Yes" if a+b <= A+B else "No")
    elif s == 'b':
        b += 1
        print("Yes" if a+b <= A+B and b <= B else "No" )
        b = min(b,B)
    else:
        print("No")

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    ll X;
    cin >> X;
    for(ll A = -2000; A <= 2000; A++) {
        for(ll B = -2000; B <= 2000; B++) {
            ll tmpA = A, tmpB = B;
            for(int i = 0; i < 4; i++) {
                tmpA *= A;
                tmpB *= B;
            }
            if(tmpA - tmpB == X) {
                cout << A << " " << B << "\n";
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int W,H;
bool inrange(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define MP make_pair
signed main(){
    int N,M,s,t;
    cin >> N >> M >> s >> t;
    --s,--t;
    vector<vector<pii>>graph(N);
    map<pii,int>mp;
    rep(i,M){
        int a,b,c,d; cin >> a >> b >> c >> d;
        --a,--b,--c;
        if(mp[pii(a,b)] == 0 || mp[pii(a,b)]>d)
            mp[pii(a,b)] = mp[pii(b,a)] = d;
        
        if(mp[pii(a,c)] == 0 || mp[pii(a,c)]>d)
            mp[pii(a,c)] = mp[pii(c,a)] = d;
        
        if(mp[pii(c,b)] == 0 || mp[pii(c,b)]>d)
            mp[pii(c,b)] = mp[pii(b,c)] = d;
    }
    for (auto itr :mp){
        graph[itr.first.first].push_back(pii(itr.first.second,itr.second));
    }
    //dijkstra
    priority_queue<pii,vector<pii>,greater<pii>>que;
    vector<int>d(N,INF*INF);
    d[s] = 0;
    pii _s = pii(0,s);
    que.push(_s);
    while(!que.empty()){
        pii temp = que.top();
        que.pop();
        int now = temp.first;
        int v = temp.second;
        if(now>d[v])continue;
        rep(i,graph[v].size()){
            int nd = now +graph[v][i].second;
            int next = graph[v][i].first;
            if(d[next] > nd){
                d[next] = nd;
                que.push(pii(nd,next));
            }
        }
    }
    cout << d[t] << endl;
}




Measured memory_bytes: 58620