akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;


void solve(long long N, std::vector<std::string> s, std::vector<long long> t, std::string X){
    vll sum(N+1, 0);
    ll ans = 0;
    bool start = false;
    REP(i, N) {
        if(start){
            ans += t[i];
        }
        if(!start && s[i] == X){
            start = true;
        }
    }
    cout<<ans<<endl;

    
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> s(N);
    std::vector<long long> t(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> s[i];
        scanf("%lld",&t[i]);
    }
    std::string X;
    std::cin >> X;
    solve(N, std::move(s), std::move(t), X);
    return 0;
}


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

theArray = [a, b, c]
minimum = min(theArray)
maximum = max(theArray)

newArray = [str(minimum), str(a+b+c-minimum-maximum), str(maximum)]



print(' '.join(newArray))

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

int main(void){
int n,a,b;
int min;
scanf("%d %d %d",&n,&a,&b);
min=mini(n,a,b);
printf("%d",min);
return 0;
}
int mini(a,b,c){
int ret;
if(a*b>=c){ret=c;}
else{ret=a*b;}
    return ret;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

long long N,Y;

int main(){
    cin >> N >> Y;
    long long a,b;
    a = (Y % 5000) / 1000;
    b = ((Y - 1000*a) % 10000) / 5000;
    for(int i=a;i<=N;i+=5){
        for(int j=0;j<=N-i;j++){
            if((long long)i*1000+(long long)j*5000+(N-i-j)*10000==Y){
                cout << N-i-j << " " << j << " " << i << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        for i in range(0, H):
            for j in range(0, W):
                if j == W - 1:
                    print("#")
                else:
                    print("#", end="")
        print("")



Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
int n,k,ans;
bool vis[105];
int main()
{
    scanf("%d %d",&n,&k);
    while(k--)
    {
        int d;
        scanf("%d",&d);
        while(d--)
        {
            int x;
            scanf("%d",&x);
            vis[x]=1;
        }
    }
    for(int i=1;i<=n;i++)ans+=!vis[i];
    printf("%d\n",ans);
    return 0;
}

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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

ll dp[1000][1000];

int main()
{
  int h, w;
  cin >> h >> w;
  string s[1000];
  for(int i = 0; i < h; i++){
    cin >> s[i];
  }

  dp[0][0] = 1;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(i == 0 and j == 0) continue;
      if(s[i][j] == '#'){
        dp[i][j] = 0;
      }else if(i == 0){
        dp[i][j] = dp[i][j-1]; 
      }else if(j == 0){
        dp[i][j] = dp[i-1][j];
      }else{
        dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % mod;
      }
//      cout << " " << dp[i][j];
    }
//    cout << endl;
  }

  cout << dp[h-1][w-1] << endl;

  return 0;
}


Measured memory_bytes: 9088
n = int(input())

tree = [[] for _ in range(n+1)]
for _ in range(n-1):
  u,v,w = map(int,input().split())
  tree[u].append([v,w])
  tree[v].append([u,w])

#print(tree)
d = [-1]*(n+1)
d[1] = 0
q = [1]
while q:
  now = q.pop()
  for n_i,n_l in tree[now]:
    if d[n_i] == -1:
      d[n_i] = d[now] + n_l
      q.append(n_i)

for l in d[1:]:
  print(l%2)

Measured memory_bytes: 49732
#!/usr/bin/env ruby
#coding: utf-8

n, m, r = gets.split.map(&:to_i)
r -= n * m
if (r < 0) 
  puts 0
else
  ans = 1
  (r + 1).upto(n + r - 1) do |i|
    ans *= i
  end
  1.upto(n - 1) do |i|
    ans /= i
  end
  puts ans
end

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

using namespace std;

int func(int k) {
    return (k*(k-1))/2;
}

bool isPalindrome(string s) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = s.length() - 1; 
  
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (s[l++] != s[h--]) 
        { 
            return 0;
        } 
    } 
   return 1;
} 


int main() {
    
    string s;
    
    cin>>s;
    
     string r = s.substr(0,(s.length()-1)/2);
     string q = s.substr(((s.length()+3)/2)-1,s.length());
    
    if(isPalindrome(s)) {
        if(isPalindrome(r)) {
            if(isPalindrome(q)) {
                cout<<"Yes";
            }
            else {
                cout<<"No";
            }
        }
        else {
            cout<<"No";
        }
    }
    
    else {
        cout<<"No";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MX = 45, N = 100005;
 
ll n, k;
ll t[MX], dt[MX], opt[MX];
ll ans;
 
int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> n >> k;
    vector<ll> a(n);
    for (auto& i : a) {
        cin >> i;
        ans += i;
        for (int j = 0; j < MX; ++j) {
            if (!((1ll << j) & i)) {
                t[j] += (1ll << j);
            } else dt[j] += (1ll << j);
        }
    }

    for (int i = 0; i < MX; ++i) opt[i] = max(t[i], dt[i]);
    
    int lm = -1;
    for (int i = MX - 1; i >= 0; --i) {
        if ((1ll << i) & k) lm = i;
        else {
            if (lm == -1) continue;
            dt[lm] += opt[i];
            t[lm] += dt[i];
            opt[lm] += opt[i];
        }
    }
 
    ll tmp = 0;
    bool lower = false;
    for (int i = MX - 1; i >= 0; --i) {
        if ((1ll << i) > k) tmp += dt[i]; 
    
        if ((1ll << i) & k) {
            if (lower) {
                tmp += opt[i];
            } else if (dt[i] >= t[i]) {
                lower = true;
                tmp += dt[i];
            } else tmp += t[i];
        }
        // cout << i << ' ' << tmp << '\n';
    }
    
    cout << max(tmp, ans);
}


Measured memory_bytes: 3976
from itertools import accumulate
n = int(input())
a = list(map(int,input().split()))
x = a[::2]
y = a[1::2]
lx = len(x)
ly = len(y)
sumx = sum([max(x[i],0) for i in range(lx)])
sumy = sum([max(y[i],0) for i in range(ly)])
ansls = []
if sumx >= sumy:
  ans = sumx
  flg = 0
else:
  ans = sumy
  flg = 1
if sumx == sumy == 0:
  ans = max(a)
  t = a.index(max(a))
  print(ans)
  print(n-1)
  for i in range(n,t+1,-1):
    print(i)
  for i in range(t):
    print(1)
  exit()
if flg:
  x = y
  lx = ly
  ansls.append(1)
  n -= 1
ls = [0]
fp = -1
fptmp = 0
for i in range(lx):
  if x[i] >= 0:
    ls.append(1)
    if fp == -1:
      fp = fptmp
  else:
    ls.append(-1)
    fptmp += 1
pnt = (n+1)//2*2-1
if pnt < n:
  ansls.append(n)
flgb = 0
while pnt > 0:
  px = (pnt+1)//2
  if not flgb and ls[px] < 0:
    ansls.append(pnt)
    ansls.append(pnt-1)
    ls.pop()
    pnt -= 2
  elif px <= fp:
    ansls.append(1)
    ansls.append(1)
    pnt -= 2
  elif ls[px] > 0:
    flgb = 1
    if px-1 <= fp:
      pnt -= 2
    elif ls[px-1] < 0:
      ansls.append(pnt-2)
      ls.pop()
      ls.pop()
      ls.append(1)
      pnt -= 2
    else:
      ansls.append(pnt-1)
      ls.pop()
      pnt -= 2
print(ans)
print(len(ansls))
print(*ansls,sep="\n")

Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

struct UnionFind{
    int num;
    vector<int> par,rank;
    UnionFind(int n):num(n),par(n),rank(n,1){
        iota(par.begin(),par.end(),0);
    }
    int root(int x){
        return (par[x]==x?x:par[x]=root(par[x]));
    }
    bool merge(int x, int y){
        x=root(x),y=root(y);
        if (x==y) return false;
        if (rank[x]<rank[y]) swap(x,y);
        par[y]=x;
        rank[x]+=rank[y];
        --num;
        return true;
    }
    bool same(int x, int y){return root(x)==root(y);}
    int size(int x){return rank[root(x)];}
    int count(){return num;}
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    UnionFind UF(N);
    for (int i=0;i<M;++i){
        int A,B; cin >> A >> B;
        UF.merge(--A,--B);
    }

    int ans=0;
    for (int i=0;i<N;++i) chmax(ans,UF.size(i));

    cout << ans << '\n';
}

Measured memory_bytes: 4760
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

double ans, cnt;

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

	int N;
	cin >> N;

	double PI = 3.14159265358979323846;


	ans = 2 * N * PI;

	printf("%.11lf", ans);

	return 0;
}


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

int parent(int i){ return i/2; }
int left(int i){ return i*2; }
int right(int i){ return i*2+1; }

int main(){
    int H, tree[100001];
    scanf("%d",&H);
    for( int i = 1; i <= H; ++i){
        scanf("%d",&tree[i]);
    }
    for( int i = 1; i <= H; ++i){
        printf("node %d: key = %d, ",i,tree[i]);
        if(parent(i)>=1) printf("parent key = %d, ",tree[parent(i)]);
        if(left(i)<=H) printf("left key = %d, ",tree[left(i)]);
        if(right(i)<=H) printf("right key = %d, ",tree[right(i)]);
        putchar('\n');
    }
    return 0;
}



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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;

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



int main() {

    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    ll ansC = (B / C) - ((A-1) / C);
    ll ansD = (B / D) - ((A-1) / D);
    // cout << ansC << ansD << endl;;

    ll _lcd = (C / gcd(C, D)) * D;
//    cout << _lcd << endl;;

    ll ans_lcd = (B / _lcd) - ((A-1) / _lcd);
//    cout << ans_lcd << endl;;

    ll ans = (B-A+1)-(ansC + ansD - ans_lcd);

    cout << ans << endl;




  
      
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
using namespace std;
typedef long long ll;
const ll MOD = (ll)998244353;
const ll N = 1e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N; cin >> N;
    vector<ll> div_num(N+5);
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
      for (ll j = i; j <= N; j+=i) {
        div_num[j]++;
      }
      ans += i * div_num[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 81016
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
  int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  sort(A.begin(),A.end());
  if(A[0]==0){cout<<0<<endl;return 0;}
  int64_t k=1;
  for(int i=0;i<N;i++){
    if(A[i]<=1000000000000000000/k){
      k*=A[i];
    }
    else{cout<<-1<<endl;return 0;}
  }
  cout<<k<<endl;
  return 0;}

Measured memory_bytes: 3960
#include<bits/stdc++.h>
int a[1001];
using namespace std;
int main()
{
    int n, m, i, cont=0, ans=0;
    cin>>n>>m;

    for(i=0;i<n;i++)
    {
        cin>>a[i];
        cont+=a[i];
    }
    for(i=0;i<n;i++)
    {
        if(a[i]*4*m>=cont)
        {
            ans++;
        }
    }
    if(ans>=m)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.flush();out.close();
    }
        static class TaskE {
         String s1="Vacant",s2="Male",s3="Female";
         int get(int l,int rf){
          if(l%2==0)return rf;else return 1-rf;
         }
         public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n=in.nextInt();
            System.out.println(0);
            String s=in.next().trim();
            if(s.equals(s1)){
             return;
            }
            int r=0;
            if(s.equals(s2))r=1;
            int L=1,R=n-1;
            while(L<=R){
             int m=(L+R)>>1;
             System.out.println(m);
             String is=in.next().trim();
             int sh=get(m,r);
             if(is.equals(s1))return;
             if(is.equals(s2)){
              if(sh==1)L=m+1;
              else R=m-1;
             }else{
              if(sh==0)L=m+1;
              else R=m-1;
             }
            }
         }
    }
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;
        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

Measured memory_bytes: 25124
#include<stdio.h>
int main(void){
	char s[100];
	int len=0, i;
	
	scanf("%s", s);
	
	for(i=1; s[i] != '\0'; i++){
		len++;
	}
	len--;
	printf("%c%d%c\n", s[0], len, s[i-1]);
	return 0;
}

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

class Program
{
    static void Main(string[] args) {
        int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] b = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] c = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Array.Sort(a);
        Array.Reverse(a);
        Array.Sort(b);
        Array.Reverse(b);
        Array.Sort(c);
        Array.Reverse(c);
        foreach(long i in solve(a,b,c, Math.Min(s[0],3000), Math.Min(s[1], 3000), Math.Min(s[2], 3000), s[3])) {
            Console.WriteLine(i);
        }
    }
    static long[] solve(long[] a, long[] b, long[] c, int x, int y, int z, int k) {
        List<long> l = new List<long>();
        for(int i = 0; i < x; i ++) {
            for(int j = 0; j < y; j ++) {
                l.Add(a[i] + b[j]);
            }
        }
        l.Sort();
        l.Reverse();
        List<long> ans = new List<long>();
        for(int i = 0; i < Math.Min(k,x*y); i ++) {
            for(int j = 0; j < z; j ++) ans.Add(l[i]+c[j]);
        }
        ans.Sort();
        ans.Reverse();
        return ans.Where((s,t) => t < k).ToArray();
    }
}

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

#ifdef _LOCAL_DEBUG
#include "templates/debug.h"
#else
#define debug(...) 
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d = 0, k;
    cin >> a >> b >> c >> k;
    while (b <= a)
        b *= 2, d++;
    while (c <= b)
        c *= 2, d++;
    cout << (d <= k ? "Yes" : "No") << endl;
    return 0;
}


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

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

  int h, w;
  cin >> h >> w;
  vector<vector<char>> res(h, vector<char>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> res[i][j];
    }
  }
  int k = 0;
  for (int i = 0; i < h; i++) {
    bool flag = false;
    for (int j = 0; j < w; j++) {
      if (res[i][j] == '#') {
        flag = true;
        break;
      }
    }
    if (flag) {
      for (int j = 0; j < w; j++) {
        res[k][j] = res[i][j];
      }
      k++;
    }
  }
  h = k;
  k = 0;
  for (int j = 0; j < w; j++) {
    bool flag = false;
    for (int i = 0; i < h; i++) {
      if (res[i][j] == '#') {
        flag = true;
        break;
      }
    }
    if (flag) {
      for (int i = 0; i < h; i++) {
        res[i][k] = res[i][j]; 
      }
      k++;
    }
  }
  w = k;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << res[i][j];
    }
    cout << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[101];
int b[101];
int n, ans;
int main()
{
	cin >> n;
	
	for(int i = 1; i < n; i++)
	{
		cin >> b[i];
		a[i] = b[i];
	}
	
	for(int i = 2; i < n; i++)//数值校正 
	{
		if(a[i]>b[i-1])
		{
			a[i]=b[i-1];
		}
	}
	a[n] = b[n-1];
	
	for(int i = 1; i <= n; i++)
	{
		ans += a[i];
	}
	
	cout << ans;
	
	return 0;
}

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

int main()
{
    int k,n;
    char a[200];
    scanf("%d%s",&k,&a);

    n = strlen(a);

    if(n<=k)
        printf("%s\n",a);
    else
    {
        for(int i=0; i<k; i++)
            printf("%c",a[i]);
        printf("...\n");
    }

    return 0;
}


Measured memory_bytes: 3668
n, k = gets.split.map(&:to_i)
h = gets.split.map(&:to_i)
dp = Array.new(n, Float::INFINITY)
dp[0] = 0
n.times do |i|
  1.upto(k) do |j|
    break if i + j > n - 1
    p = dp[i] + (h[i] - h[i + j]).abs
    dp[i + j] = p if p < dp[i + j]
  end
end
puts dp[n - 1]

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
	int A, P; cin >> A >> P;
	cout << (3 * A + P) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  ll k,a,b;cin>>k>>a>>b;
  if((a+2)>=b){
    P(k+1);
  }else {
    if(k<=a){
      P(k+1);
    }else{
      if((k-a+1)%2==0){
        P(a+((k-a+1)/2)*(b-a));
        // P("ok");
      }else{
        P(a+((k-a+1)/2)*(b-a) + 1);
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
n = input()

monster = [int(x) for x in input().split()]

while(True):
	minIndex = monster.index(min(monster))
	for i in range(len(monster)): 
		if i == minIndex or monster[i] == 0:
			continue
		if monster[i] % monster[minIndex] == 0:
			monster[i] = 0
		else:
			monster[i] -= monster[minIndex] * (monster[i]//monster[minIndex])
	monster = [x for x in monster if x != 0]
	if len(monster) == 1:
		print(monster[0])
		break

Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main() {
	string s,t;
	cin>>s>>t;
	if(s.size()!=t.size()) {
		cout<<"No";
		return 0;
	}
	int n=s.size();
	int i=0,k;
	for(int j=0; j<n; ++j) {
		k=0;
		while(s[(i+k)%n]==t[(j+k)%n]) {
			k++;
			if(k==n) {
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    void solve() throws IOException {
        int n = ni();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 2; i <= n; i++) {
            int t = i;
            for (int j = 2; j * j <= t; j++) {
                if (t % j == 0) {
                    int cnt = 0;
                    while (t % j == 0) {
                        cnt++;
                        t /= j;
                    }
                    if (map.containsKey(j)) {
                        map.put(j, map.get(j) + cnt);
                    } else {
                        map.put(j, cnt);
                    }
                }
            }
            if (t != 1) {
                if (map.containsKey(t)) {
                    map.put(t, map.get(t) + 1);
                } else {
                    map.put(t, 1);
                }
            }
        }

        long MOD = 1000000007;

        long ans = 1;
        for (int x : map.values()) {
            ans = (ans * (x + 1)) % MOD;
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 8524
#include<bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
using namespace std;

//***********************************************************************

// hash struct for unordered_map
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int MAXNUM = 5e3+5;
vector <int>vis(MAXNUM);
vector<int> pr;
void sieve() {
	pr.push_back(2);
	for(ll i=3;i<MAXNUM;i+=2) if(!vis[i]) {
		pr.push_back(i);
		for(ll j=i*i;j<MAXNUM;j+=2*i) vis[j]=true;
	}
}
//************************************************************************
ll mod=1000000007;
void solve()
{
    ll n,m,k;
    cin >> n >>m >> k;
    vector<vector<char>> v(n,vector<char>(m));
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin >> v[i][j];
        }
    }
    ll ans=0;
    for(int m1=0;m1<(1<<n);m1++)
    {
        for(int m2=0;m2<(1<<m);m2++)
        {
            int c=0;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    if(v[i][j]=='#' && !((1<<i)&m1) && !((1<<j)&m2))
                    c++;
                }
            }
            if(c==k)
            ans++;
        }
    }
    cout << ans << endl;
}


int main()
{ 
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	ll t;
	//cin >> t;
	t=1;
	while(t--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3656
from bisect import bisect_left


def main():
    length = int(input())
    now_rate = list(map(int, input().split()))
    target_rate = list(map(int, input().split()))
    difference = [0] * length
    for i in range(length):
        difference[i] = now_rate[i] - target_rate[i]
    difference.sort()
    zero_index = bisect_left(difference, 0)
    answer = zero_index
    if zero_index > 0:
        has_prepared = difference[zero_index:]
        not_yet = sum(difference[:zero_index])
        for i in range(-1, -len(has_prepared) - 1, -1):
            not_yet += has_prepared[i]
            if not_yet >= 0:
                answer += abs(i)
                break
        else:
            answer = -1
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 19188
package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	N := readString()

	b := []byte(N)
	x, y := 0, 0

	t := int(b[len(b)-1] - '0')
	x, y = x+t, y+(10-t)

	for i := len(b) - 2; i >= 0; i-- {
		t := int(b[i] - '0')
		x, y = min(x+t, y+(t+1)), min(x+(10-t), y+(10-(t+1)))
	}
	fmt.Println(min(x, y+1))
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}


Measured memory_bytes: 3712
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

/*

n >= m の場合は、何も移動しなくて良い

n < m の場合は、いくつか移動しないとできない

x[j] はソートされているとする。
x[j] の隣り合う項の差を y[j] = x[j + 1] - x[j] とする。
y[j] をソートして、小さい方から (n - m) 個が答え

*/

void main(){
	int n = read.to!int;
	int m = read.to!int;
	long[] xs = readln.chomp.split.map!(to!long).array;
	
	xs.sort();
	
	long[] ys;
	foreach(j; 0 .. m - 1) ys ~= xs[j + 1] - xs[j];
	
	ys.sort();
	
	long ans;
	if(n >= m) ans = 0;
	else foreach(j; 0 .. m - n) ans += ys[j];
	
	ans.writeln;
}


Measured memory_bytes: 4232
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<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()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let M: usize = read();
    let mut graph: Vec<Vec<usize>> = vec![vec![]; N];
    for _ in 0..M {
        let a: usize = read::<usize>() - 1;
        let b: usize = read::<usize>() - 1;
        graph[a].push(b);
        graph[b].push(a);
    }
    use std::collections::VecDeque;
    let mut queue: VecDeque<(usize, Vec<usize>)> = VecDeque::new();
    queue.push_front((0, vec![0]));
    let mut ans = 0;
    while let Some((num, path)) = queue.pop_back() {
        if path.len() == N {
            ans += 1;
        }
        for &next in &graph[num] {
            if !path.contains(&next) {
                let mut path = path.clone();
                path.push(next);
                queue.push_front((next, path));
            }
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
s = list(str(input()))
q = int(input())
o = ['']*q
for i in range(q):
    o[i] = str(input())
    
for i in range(q):
    order = o[i].split(' ')
    if order[0] == 'print':
        a,b = int(order[1]),int(order[2])
        for i in range(a,b+1):
            print(s[i],end = '')
        print('')

    elif order[0] == 'reverse':
        a,b = int(order[1]),int(order[2])
        tmp = s[a:b+1]
        tmp.reverse()
        s[a:b+1] = tmp        
        
    elif order[0] == 'replace':
        a,b,p = int(order[1]),int(order[2]),list(order[3])
        for i in range(b-a+1):
            s[a+i] = p[i]

Measured memory_bytes: 8980
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 2;
void solve() {
    ld A, B, H, M; cin >> A >> B >> H >> M;
    ld ang1 = H * 30.0;
    ang1 += M * 0.5;
    ld ang2 = M * 6.0;
    ld ang = abs(ang1-ang2);
    ang /= 180.0;
    ang *= M_PI;
    ld ans = sqrt(A*A + B*B - 2.0*A*B*cos(ang));
    cout << fixed << setprecision(12) << ans << endl;

}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 4168
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision; // int64_tは9*10^18まで、intは2*10^9まで

#define INF (int)pow(10, 8)
typedef tuple<int, int, int> P;

int main() {
  int h, w;
  cin >> h >> w;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  x1-=1;
  y1-=1;
  x2-=1;
  y2-=1;
  char s[h][w];
  int d[h][w];
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++) {
      d[i][j] = INF;
    }
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      cin >> s[i][j];

  priority_queue<P, vector<P>, greater<P>> que;
  que.push({0, x1, y1});
  d[x1][y1] = 0;

  while (!que.empty()) {
    P p = que.top();
    que.pop();
    int x = get<1>(p), y = get<2>(p), z=get<0>(p);

    if (x + 1 < h && s[x + 1][y] == '.' && d[x + 1][y]>z) {
      d[x + 1][y] = z;
      que.push(P(z, x + 1, y));
    }
    if (y - 1 >= 0 && s[x][y - 1] == '.' && d[x][y - 1]>z) {
      d[x][y - 1] = z;
      que.push(P(z, x, y - 1));
    }
    if (x - 1 >= 0 && s[x - 1][y] == '.' && d[x - 1][y]>z) {
      d[x - 1][y] = z;
      que.push(P(z, x - 1, y));
    }
    if (y+1<w && s[x][y + 1] == '.' && d[x][y + 1]>z) {
      d[x][y+1] = z;
      que.push(P(d[x][y + 1], x , y + 1));
    }
    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        if (x + i >= 0 && x + i < h && y + j >= 0 && y + j < w && s[x + i][y + j] == '.' &&d[x+i][y+j]>z) {
          d[x + i][y + j] = z+1;
          que.push(P(z+1, x + i, y + j));
        }
      }
    }
  }
  if (d[x2][y2] == INF)
    cout << -1;
  else
    cout << d[x2][y2];
  return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  int data[m] ={};
  for (int i = 0; i < n; i++){
    int k;
    cin >> k;
    for (int j = 0; j < k; j++){
      int a;
      cin >> a;
      data[a-1] ++;
    }
  }
  int ans = 0;
  for (int i = 0; i < m; i++){
    if (data[i] == n){
      ans ++;
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>

#define MAX 2000001

void CountingSort(int [], int [], int, int);

int B[MAX], C[MAX];

int main(){
  
  int A[MAX];
  int n, i, j, l = 0;

  scanf("%d", &n); 
  for(i = 1; i <= n; i++){
    scanf("%d", &A[i]);
    if(l < A[i]) l = A[i];
  }

  CountingSort(A, B, l, n);

  return 0;
}

void CountingSort(int A[], int B[], int l, int n){
  
  int i, j;

  for(i = 0; i <= l; i++)
    C[i] = 0;
  
  for(j = 1; j <= n; j++)
    C[A[j]]++;

  for(i = 1; i <= l; i++)
    C[i] = C[i] + C[i - 1];
 
  for(j = n; j >= 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i = 1; i <= n; i++){
    printf("%d", B[i]);
    if(i != n) printf(" ");
  }
  printf("\n");

}




Measured memory_bytes: 17400
#include <iostream>
using namespace std;
int main(void){
    long long int a, b;
    while(cin >> a >> b){
        long long int tmp;
        if(a < b){
            tmp = a;
            a = b;
            b = tmp;
        }

        long long int m = a * b;
        //ユークリッドの互除法を用いて最大公約数を求める
        long long int r = a % b;
        while(r != 0){
            a = b;
            b = r;
            r = a % b;
        }
        long long int gcd = b;

        //続いて、公式を用いて最小公倍数を求める
        long long int lcm = m / gcd;

        cout << gcd << " " << lcm << endl;
    }
}



Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	int a, b; cin >> a >> b;
	if (a <= 5) cout << 0 << endl;
	else if (a <= 12) cout << b / 2 << endl;
	else cout << b << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=2005;
const int maxf=4e6+5;
const LL mo=1e9+7;
int n,k;
LL F[maxn][maxn],fac[maxf],inv[maxf];
LL kpow(LL x,LL y,LL p)
{
	LL s=1LL;
	while(y){
		if((y&1LL)) s=s*x%p;
		x=x*x%p;
		y>>=1;
	}
	return s;
}
LL C(int x,int y)
{
	if(x<y||y<0) return 0;
	if(!y||x==y) return 1LL;
	return (fac[x]*inv[y]%mo)*inv[x-y]%mo;
}
void pre()
{
	fac[0]=1LL;
	for(int i=1;i<=n*k;++i) fac[i]=fac[i-1]*i%mo;
	inv[n*k]=kpow(fac[n*k],mo-2,mo);
	for(int i=n*k-1;i>=1;--i) inv[i]=inv[i+1]*(i+1)%mo;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i) F[i][0]=1;
	if(k==1) printf("1");
	else{
		pre();
		//cout<<C(1,1);
		for(int i=1;i<=n;++i)
		  for(int j=1;j<=i;++j){
		  	LL s=F[i][j-1]*(n-j+1)%mo;
		  	s=s*C(n*k-i-(j-1)*(k-1)-1,k-2)%mo;
		  	F[i][j]=(F[i-1][j]+s)%mo;
		  	//cout<<i<<" "<<j<<" "<<F[i][j]<<" "<<F[i-1][j]<<" "<<F[i][j-1]<<endl;
		  	//cout<<(n*k-i-(j-1)*(k-1)-1)<<" "<<k-2<<" "<<C(n*k-i-(j-1)*(k-1)-1,k-2)<<endl;
		  }
		printf("%lld",F[n][n]);
	}
	return 0;
}

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

using namespace std;

const int N = 200005;

int n, tab[N];

int main() {
    
    scanf("%d", &n);
    
    for (int i = 1; i <= n; i++) {
        scanf("%d", &tab[i]);
    }
    
    long long ans = 0;
    int last = 0;
    
    for (int i = n; i >= 1; i--) {
        last--;
        if (tab[i] != last) {
            if (tab[i] >= i || tab[i] < last) {
                printf("-1\n");
                return 0;
            }
            ans += tab[i];
            last = tab[i];
        }
    }
    
    printf("%lld\n", ans);
    
    return 0;
}

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

typedef long long ll;
#define N (1<<18)

ll ai[N*2];
ll value[N*2];
ll max_num = 1;

void lazy_update(int k){
    if(value[k] == -1)return;
    if(k < N-1){
        value[k*2+1] = value[k];
        value[k*2+2] = value[k];
    }
    value[k] = -1;
}

ll update(int a, int b, int x, int k = 0, int l = 0, int r = N){
    if(value[k] != -1) ai[k] = value[k];
    if(r <= a || b <= l) return ai[k];
    if(a <= l && r <= b){
        value[k] = ai[k] = x;
        return ai[k];
    }
    lazy_update(k);
    ll vl = update(a, b, x, k*2+1, l, (l+r)/2);
    ll vr = update(a, b, x, k*2+2, (l+r)/2, r);
    ai[k] = min(vl, vr);
    return ai[k];
}

ll find(int a, int b, int k = 0, int l = 0, int r = N){
    if(value[k] != -1) ai[k] = value[k];
    if(r <= a || b <= l) return max_num;
    if(a <= l && r <= b) return ai[k];
    lazy_update(k);
    ll resultl = find(a, b, k*2+1, l, (l+r)/2);
    ll resultr = find(a, b, k*2+2, (l+r)/2, r);
    return min(resultl, resultr);
}

int main(){
    for(int i = 0; i < 31; i++) max_num *= 2;
    max_num -= 1;

    for(int i = 0; i < N*2; i++){
        ai[i] = max_num;
        value[i] = -1;
    }

    int n, q;
    cin >> n >> q;

    for(int i = 0; i < q; i++){
        int com, s, t, x;
        cin >> com;
        if(com == 0){
            cin >> s >> t >> x;
            update(s, t+1, x);
        }else{
            cin >> s >> t;
            cout << find(s, t+1) << endl;
        }
    }
}


Measured memory_bytes: 11304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

int main() {
    ll x;
    cin >> x;
    ll ans = x / 11;
    ans *= 2;
    if (x % 11 > 0) ans++;
    if (x % 11 > 6) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 120000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

int main() {
    int n;
    cin >> n;
    vector<LL> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    LL cnt = 0;
    for (int i = 0; i < n; i++) {
        LL an = upper_bound(a.begin(), a.end(), b[i] - 1) - a.begin();
        LL cn = c.size() - (lower_bound(c.begin(), c.end(), b[i] + 1) - c.begin());
        cnt += an * cn;
    }
    cout << cnt << endl;

    return 0;
}


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

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    a*b>c*d?cout<<a*b : cout<<c*d;
}

Measured memory_bytes: 3520
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
cnt = 0

for n in range(N):
    A = list(map(int,input().split()))
    ans = 0
    for i in range(M):
        ans += A[i]*B[i]
    if ans > -C:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		
		out.println(new BigDecimal(Math.pow(Math.floor(Math.sqrt(n)), 2)).toPlainString());
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class UnionFind {
	int[] par;

	public UnionFind(int n) {
		par = new int[n];

		Arrays.fill(par, -1);
	}

	int root(int x) {
		if(par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	boolean unite(int x,int y) {
		x = root(x);
		y = root(y);

		if(x == y) return false;

		if(size(x) < size(y)) {
			int tmp = x;
			x = y;
			y = tmp;
		}

		par[x] += par[y];
		par[y] = x;

		return true;
	}

	boolean same(int x,int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

	int size(int a) {
		return -par[root(a)];
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 22100
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class UnionFind():
    def __init__(self):
        self.__table = {}
        self.__size = defaultdict(lambda: 1)

    def __root(self, x):
        if x not in self.__table:
            self.__table[x] = x
        elif x != self.__table[x]:
            self.__table[x] = self.__root(self.__table[x])

        return self.__table[x]

    def root(self, x):
        return self.__root(x)

    def same(self, x, y):
        return self.__root(x) == self.__root(y)

    def union(self, x, y):
        x = self.__root(x)
        y = self.__root(y)
        if x != y:
            self.__size[y] += self.__size[x]
            self.__table[x] = y

    def size(self, x):
        return self.__size[self.__root(x)]

    def num_of_group(self):
        g = 0
        for k, v in self.__table.items():
            if k == v:
                g += 1
        return g


@mt
def slv(N, M, A, XY):
    uf = UnionFind()

    for x, y in XY:
        uf.union(x, y)

    d = defaultdict(list)
    for i in range(N):
        d[uf.root(i)].append(A[i])

    for v in d.values():
        heapq.heapify(v)

    if len(d) == 1:
        return 0
    ans = 0
    n = []
    for v in d.values():
        ans += heapq.heappop(v)
        n.extend(v)

    e = len(d)-2
    n.sort()
    if len(n) < e:
        return 'Impossible'
    ans += sum(n[:e])
    return ans


def main():
    N, M = read_int_n()
    A = read_int_n()
    XY = [read_int_n() for _ in range(M)]
    print(slv(N, M, A, XY))


if __name__ == '__main__':
    main()


Measured memory_bytes: 51828