akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================



	ll N;
	cin >> N;

	vll P(N);
	for (int i = 0; i < N; i++) {
		cin >> P[i];
	}

	ll ans = 0;
	ll local_min = P[0];

	for (int i = 0; i < N; i++) {
		local_min = min(local_min, P[i]);

		if (P[i] <= local_min) {
			ans++;
		}


	}


	cout << ans;


}


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

int main(){
  string A;
  cin >> A;
  if(A.at(0)!=A.at(1)&&A.at(0)!=A.at(2)&&A.at(1)!=A.at(2)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define MOD 1000000007;

int main() {
    int n;
    cin >> n;
    vector<int> A;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        A.push_back(x);
    }

    vector<int> B;
    // 要素数が偶数の時
    if (n % 2 == 0) { 
        int nHalf = n / 2;
        int tmpN = n - 1;
        // 配列の前半埋める
        for (int i = 0; i < nHalf; i++) {
            B.push_back(tmpN);
            tmpN -= 2;
        }
        // 配列の後半埋める
        tmpN = 1;
        for (int i = 0; i < nHalf; i++) {
            B.push_back(tmpN);
            tmpN += 2;
        }
    } else { // 要素数が奇数
        int nHalf = n / 2;
        int tmpN = n - 1;
        // 配列の前半埋める
        for (int i = 0; i < nHalf; i++) {
            B.push_back(tmpN);
            tmpN -= 2;
        }
            B.push_back(0);
        // 配列の後半埋める
        tmpN = 2;
        for (int i = 0; i < nHalf; i++) {
            B.push_back(tmpN);
            tmpN += 2;
        }

    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    for (int i = 0; i < n; i++) {
        if (A[i] != B[i]) {
            cout << "0" << endl;
            return 0; // 一致しないならここで終了
        }
    }

    int nHalf = n / 2;
    int ans = 1;
    for (int i = 0; i < nHalf; i++) {
        ans = (ans * 2) % MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1400
#pragma GCC optimize("O3")
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<string>
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FOR(i,l,r) for(int i = l ; i <= r ;++i )
#define ALL(T)  T.begin(),T.end()
#define lson(i)     i<<1
#define rson(i)     (i<<1|1)
#define ll long long 
#define pu push
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define is insert
#define se second
#define sz(x) ((int)(x).size())
#define len(x) ((int)(x).length())
#define debug(x) cout << "[" << #x << ": " << (x) << "]" << endl
#define endl "\n"
#define in inline
using namespace std;
typedef pair<int,int> pii;
const int N = 1e5+10;
const int INF = 1<<30;
int a[N];
int dp[N];
int n;
int main(){
    int a,b;
    cin >> a >> b;
    int ans = (b-1)/(a-1);
    if((b-1)%(a-1)) ans++;
    // int c = a,ans = 1;
    // while(c<b){
    //     c += a-1;
    //     ans++;
    // }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//<--sbhmsh-- Shubham Jaiswal>//

#include <bits/stdc++.h>
#include <iostream>
#define FASTIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lli long long int
#define endl '\n'
#define deb cout<<"sab_badhiya"<<endl;
// const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
const long INF = 1000 * 1000 * 1000;
const long long int mod = 1000000007;

int main(){
  FASTIO
  long double a, h, x, m;
  cin >> a >> h >> x;
  long double ans,pi = 3.1415926535897932384626, l, area;

  area = (a*a*h)/double(2);
  // cout << area << endl;
  if(area>x){
    l = (2*x)/(a*h);
    ans = atan2(h, l);
    ans = ans *(180/pi);
    // cout << ans << endl;
  }
  else {
    l = 2*h - (2*x)/(a*a);
    ans = atan2(l, a);
    ans = ans *(180/pi);
  }

  cout << setprecision(15)<<fixed<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
// initialize: UnionFind UF(N)

class UnionFind {                                              // OOP style
private:
	vector<int> p, rank, setSize;
	// p = path toward the root of disjoint set; p[i] = i means it is root
	// rank = upper bound of the actual height of the tree; not reliable as accurate measure
	// setSize = size of each disjoint set

	int numSets;
public:
	UnionFind(int N) {
		setSize.assign(N, 1);
		numSets = N;
		rank.assign(N, 0);
		p.assign(N, 0);
		for (int i = 0; i < N; i++) p[i] = i;	// each belongs to its own set
	}

	int findSet(int i) {
		return (p[i] == i) ? i : (p[i] = findSet(p[i]));		// path compression: cut short of the path if possible
	}

	bool isSameSet(int i, int j) {
		return findSet(i) == findSet(j);
	}

	void unionSet(int i, int j) {
		if (!isSameSet(i, j)) {
			numSets--;
			int x = findSet(i), y = findSet(j);
			// rank is used to keep the tree short
			if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
			else {
				p[x] = y; setSize[y] += setSize[x];
				if (rank[x] == rank[y]) rank[y]++;
			}
		}
	}

	int numDisjointSets() {		// # of disjoint sets
		return numSets;
	}

	int sizeOfSet(int i) {		// size of set
		return setSize[findSet(i)];
	}
};


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, mm, a, b, i, j, k;
	cin >> n >> m >> mm;

	UnionFind f1(n + 1), f2(n + 1);
	while (m--) {
		cin >> a >> b;
		f1.unionSet(a, b);
	}
	while (mm--) {
		cin >> a >> b;
		f2.unionSet(a, b);
	}

	map<pair<int, int>, int> ct;
	for (i = 1; i <= n; i++) {
		ct[{ f1.findSet(i), f2.findSet(i) }]++;
	}

	for (i = 1; i <= n; i++) {
		cout << ct[{ f1.findSet(i), f2.findSet(i) }] << " ";
	}
	cout << "\n";

	return 0;
}



Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }eni(!=) cerr  << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
} sim dor(rge<c> d) { *this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
#define err(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll=long long;
using vi=vector<int>;



int main() {
    ios::sync_with_stdio(false) , cin.tie(0);
    int n;
    cin >> n;
    vector< int > a(n);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    vi order(n);
    iota(order.begin() , order.end() , 0);
    sort(all(order) , [&](int i , int j){ return a[i] < a[j]; } );
    for(int i = 0; i < n; i++){
      cout << order[i]  + 1<< " ";
    }



    return 0;
}



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

int main() {
    ll n;
    cin >> n;
    ll d;
    for(ll i = sqrt(n); i > 0; i--) {
        if (n % i == 0) {
            d = n / i;
            break;
        }
    }
    cout << to_string(d).length() << endl;
    return 0;
}


Measured memory_bytes: 256
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N = int(input())
    T = read_lists(N)
    Q = []
    for a, b in T:
        heapq.heappush(Q, (a, -1))
        heapq.heappush(Q, (b, 1))

    K1 = (N - 1) // 2 + 1
    K2 = N // 2 + 1

    s = 0
    t = 0
    S = [0, 0]
    T = [0, 0]
    while s < K2:
        a, k = heapq.heappop(Q)
        if k < 0:
            t += 1
        else:
            t -= 1
            s += 1
        
        if S[0] == 0 and s + t >= K1:
            S[0] = a
        
        if S[1] == 0 and s >= K1:
            S[1] = a
        
        if T[0] == 0 and s + t >= K2:
            T[0] = a
        
        if T[1] == 0 and s >= K2:
            T[1] = a

    if N % 2 == 1:
        print(S[1] - S[0] + 1)
    else:
        print((S[1] + T[1]) - (S[0] + T[0]) + 1)


if __name__ == "__main__":
    main()



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

#define ll long long
const int N = 2005;
const int mod = 1e9+7;
int fac[N],combi[N][N];

int add(int x,int y) {
   int ret = ((x+y)%mod + mod)%mod;
   return ret;
}
int mul(int x,int y) {
   ll ret = (ll)x*y;
   ret%=mod;
   return ret;
}


int num[2];
int group[2];
int dp[N][N];
int inv[N];

int invFac[N];

int solveDp(int x,int rem) {
   if(rem==0) {
      return 1;
   }
   if(x>num[1]) {
      return 0;
   }
   int &ret = dp[x][rem];
   if(ret != -1) {
      return ret;
   }
   ret = solveDp(x+1,rem);
   int cur = 1;
   for(int j = 0;j<group[0];++j) {
      cur = mul(cur, invFac[x]);
   }
   for(int f = group[0];f<=group[1] && f*x<=rem;++f) {
      int tot = f*x;
      int m = fac[tot];
      int t = cur;
      t = mul(t, invFac[f]);
      m = mul(t,m);
      m = mul(combi[rem][tot],m);
      ret = add(ret, mul(m,solveDp(x+1,rem-tot)));
      cur = mul(cur,invFac[x]);
   }
   return ret;
}

int myPow(int x,int c) {
   int ret = 1;
   while(c>0) {
      if(c&1) {
         ret = mul(ret,x);
      }
      x = mul(x,x);
      c/=2;
   }
   return ret;
}
void solve() {
   int n;
   memset(dp,-1,sizeof(dp));
   scanf("%d",&n);
   for(int i=0;i<2;++i) {
      scanf("%d",&num[i]);
   }
   for(int i=0;i<2;++i) {
      scanf("%d",&group[i]);
   }
   fac[0] = 1;
   inv[0] = 1;
   invFac[0] = 1;
   for(int i=1;i<N;++i) {
      fac[i] = mul(fac[i-1],i);
      inv[i] = myPow(i,mod-2);
      invFac[i] = myPow(fac[i],mod-2);
   }
   for(int i=0;i<N;++i) {
      combi[i][i] = combi[i][0] = 1;
      for(int j = 1;j<i;++j) {
         combi[i][j] = add(combi[i-1][j],combi[i-1][j-1]);
      }
   }
   printf("%d\n", solveDp(num[0],n));
}

int main()
{
   //freopen("input.txt","r",stdin);
   solve();
}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
inline int add(int x, int y, int mod) {
   if (y >= mod) y %= mod;
   if (x >= mod) x %= mod;
   x  += y;
   return (x >= mod ? x - mod : x);
} 
inline int mul(int x, int y, int mod) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  return (x*y) % mod;
}
inline int sub(int x, int y, int mod) {
  x -= y;
  if (x + mod <= 0) {
	x %= mod;
  }
  return (x < 0 ? x+mod : x);
}
int PowerMod(int x, int n, int mod) {
  int res = 1;
  for (;n > 0;) {
	if (n & 1) {
	  res 	= mul(res, x, mod);
	}
	x = mul(x, x, mod);
	n /= 2;
  }
  return res;
}
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n,k;
		cin >> n >> k ;
		// my possible gcds can be --> 1,2,3,.... k 
		for(int i =k;i>=1;i--){
			int tot_multp = k/i; // let curr gcd be i , then we can obtain this gcd by its multiples.
			dp[i]= PowerMod(tot_multp,n,MOD); 
			// avoid overcounting .. so remove multiples..
			int extra= 0 ;
			for(int j=2*i;j<=k;j+=i){
				extra = add(extra, dp[j],MOD);
			} 
			dp[i] =sub(dp[i],extra,MOD); // this is original count for getting gcd i.
		}
		int ans=0;
		for(int i =1;i<=k;i++){
			ans = add(ans,mul(i,dp[i],MOD),MOD);	// totalling the sum 
		}
		cout << ans;
	
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 4488
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("text1.in","r",stdin);
	//freopen("text1.out","w",stdout);
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl; 
	return 0;
}


Measured memory_bytes: 3608
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long count=0;
		HashMap<String,Integer> map = new HashMap<String,Integer>();
		for(int i=0;i<n;i++) {
			String str = sc.next();
			char[] temp= str.toCharArray();
			Arrays.sort(temp);
			String str2=String.valueOf(temp);
			if(map.containsKey(str2)) {
				int temp2=map.get(str2);
				count+=temp2;
				map.put(str2,temp2+1);
			}else {
				map.put(str2, 1);
			}
		}
		sc.close();
		System.out.println(count);
	}
}

Measured memory_bytes: 53216
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 301000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,K;
int main(){
    cin >> N >> K;
    int H[100100];
    for(int i = 0; i < N; i++) cin >> H[i];
    int dp[100100];
    for(int i = 0; i <= 100100; i++) dp[i] = MM;
    dp[0] = 0; dp[1] = abs(H[1]-H[0]);
    for(int i = 0; i < N; i++){
        for(int j = 1; j <= K; j++){
            if(i+j < N) dp[i+j] = min(dp[i+j], dp[i]+abs(H[i]-H[i+j]));
        }
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

//#define debug(x) ;
#define debug(x) cerr << #x << " = " << x << "\n";

ostream& operator<<(ostream& cerr, vector<ll> aux) {
  cerr << "[";
  for (auto e : aux) cerr << e << ' ';
  cerr << "]";
  return cerr;
}

const ll inf = 1LL << 52;
const int maxPow = 61;

int t;
ll n, a, b, c, d;
ll dp[maxPow + 1][maxPow + 1][maxPow + 1][2];

void upd(ll& dest, ll sour) {
  if (sour < dest) dest = sour;
}

void expand(int i, int j, int k, int bonus, ll rem, ll cost) {
  ll act = rem % 2;
  upd(dp[i + 1][j][k][(bonus && (act == 0)) ? 1 : 0], cost + a + act * d);
  if (act != 0) upd(dp[i + 1][j][k][1], cost + a + (2 - act) * d);

  act = rem % 3;
  upd(dp[i][j + 1][k][(bonus && (act == 0)) ? 1 : 0], cost + b + act * d);
  if (act != 0) upd(dp[i][j + 1][k][1], cost + b + (3 - act) * d);

  act = rem % 5;
  upd(dp[i][j][k + 1][(bonus && (act == 0)) ? 1 : 0], cost + c + act * d);
  if (act != 0) upd(dp[i][j][k + 1][1], cost + c + (5 - act) * d);
}

ll solve() {
  ll answer = inf;

  for (int i = 0; i < maxPow; i++)
    for (int j = 0; j < maxPow; j++)
      for (int k = 0; k < maxPow; k++)
        dp[i][j][k][0] = dp[i][j][k][1] = inf;

  dp[0][0][0][0] = 0;

  ll auxi = n;
  for (int i = 0; i < maxPow; i++, auxi >>= 1) {
    ll auxj = auxi;

    for (int j = 0; j < maxPow; j++, auxj /= 3) {
      ll auxk = auxj;

      for (int k = 0; k < maxPow; k++, auxk /= 5) {
       ll aux = auxk;

       for (ll bonus = 0; bonus < 2; bonus++, aux++) {

         if (dp[i][j][k][bonus] >= answer) continue;

         /*
         cerr << i << ' ' << j << ' ' << k << ' ' << bonus << '\n';
         cerr << answer << ' ' << aux << ' ' << dp[i][j][k][bonus] << '\n';
         cerr << '\n';
         */

         if (aux == 0 || (answer - dp[i][j][k][bonus]) / aux >= d)
           upd(answer, dp[i][j][k][bonus] + d * aux);

         if (aux == 0) continue;
         expand(i, j, k, bonus, aux, dp[i][j][k][bonus]);
       }
      }
    }
  }

  return answer;
}

int main()
{
  //freopen("test.in", "r", stdin);

  cin >> t;
  for (int ti = 1; ti <= t; ti++) {
    cin >> n >> a >> b >> c >> d;
    cout << solve() << '\n';
  }

  return 0;
}


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

int main(){
  int a,b;cin>>a>>b;
  if(a%b==0){
  cout<<a/b;
  }
  else{
    cout<<a/b+1;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#define MIN 1<<31-1
#define HMAX 1000000000000000000
#define MOD 1000000007
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RSET(s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
typedef long long int ll;
using namespace std;
char shu[1000][1000];
int main()
{
	int a,b;
	cin>>a>>b;
	for(int i=1;i<a+1;i++)
		for(int k=1;k<b+1;k++)
		{
			cin>>shu[i][k];
		}
	for(int i=1;i<a+1;i++)
		for(int k=1;k<b+1;k++)
		{
			int bad=0;
			if(shu[i][k]=='#'&&shu[i-1][k]!='#'&&shu[i][k-1]!='#'&&shu[i+1][k]!='#'&&shu[i][k+1]!='#')
			{
				bad=1;
			}
			if(bad)
			{
				cout<<"No";
				return 0; 
			} 
		}
	cout<<"Yes";
}

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

typedef long long int ll;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }

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

    cout << ans;

    return 0;
}

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

inline int read(){
	int x=0;bool f=1;char ch=getchar();
	while(!isdigit(ch))
		if(ch=='-')
			f=0;
	while(isdigit(ch)){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return(f)?x:-x;
}

inline void write(int x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+48);
}

int main(){
	int n=read(),d[n+2],sum=0;
	for(int i=1;i<=n;++i)
		d[i]=read();
	sort(d+1,d+n+1);
	d[0]=0,d[n+1]=d[n]+1;
	for(int i=n;i>=1;--i){
		if(d[i]<d[i+1])++sum;
	}
	write(sum);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int main(){
  int stack[100],i=0,ans=1;
  char abc[100];
 
  while( scanf("%s", abc) != EOF ){

    if ( abc[0] == '+' ){
      stack[i-2] += stack[i-1];
      i--;
    }
    else if ( abc[0] == '-' ){
      stack[i-2] -= stack[i-1];
      i--;
    }
    else if ( abc[0] == '*' ){
      stack[i-2] *= stack[i-1];
      i--;
    } 
    else {
      stack[i++] = atoi(abc);
    }
  }

  printf("%d\n",stack[0]);
  return 0;

}

Measured memory_bytes: 548
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = 1; i < (ll)(n); i++)
#define P pair<ll, ll>
typedef long long ll;
const ll mod = 1e9+7;

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

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(int x, int y){
  if(x % y == 1) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(int x, int y){
  return x * y / gcd(x, y);
}
// n個の最大公約数
ll ngcd(vector<int> a){
  int res;
  res = a[0];
  for(int i=1; i<a.size() && res!=1; i++){
    res = gcd(res, a[i]);
  }
  return res;
}
// n個の最小公倍数
ll nlcm(vector<int> a){
  int res;
  res = a[0];
  REP(i, a.size()){
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(int x){
  int i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
int digsum(int x){
  int res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  string s;
  cin >> s;
  int ans = 1001001001;
  for(int i = 2; i < s.size(); i++){
    int a = s[i-2] - '0';
    int b = s[i-1] - '0';
    int c = s[i] - '0';
    int x = a*100 + b*10 + c;
    ans = min(ans, abs(x - 753));
  }
  cout << ans << endl;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,ans=0;
	scanf("%d %d",&a,&b);
	if(a>=b){ans+=a;a--;}
	else {ans+=b;b--;}
	printf("%d",ans+max(a,b));
	return 0;
}

Measured memory_bytes: 256
def damage x, y#safe -> poison
    d = 0
    d += @a - x if @a > x
    d += x - @c if x > @c
    d += @b - y if @b > y
    d += y - @d if y > @d
    d
end

while true
    n = gets.to_i
    break if n == 0
    @a, @b, @c, @d = gets.chomp.split.map(&:to_i)
    d = 0
    x, y = gets.chomp.split.map(&:to_i)
    n.times{
        d1 = (x.between?(@a, @c) && y.between?(@b, @d)) ? 0 : damage(x, y) - 1
        x2, y2 = gets.chomp.split.map(&:to_i)
        d2 = damage(x2, y2)
        d3 = (x - x2).abs + (y - y2).abs
        d += [d1 + d2, d3].min
#        puts "#{d1} #{d2} #{d3} #{d}"
        x, y = x2, y2
        }
    puts d
end


Measured memory_bytes: 6884
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")
 
#include <bits/stdc++.h>
using namespace std;
 
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
// #define ost tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
#define    int                      long long int
#define    ld                       long double
#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL),cout.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int ttt; cin >> ttt; while(ttt--)
#define    ff                       first
#define    ss                       second
#define    all(container)            container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    sp(x)                    setprecision(x)
#define    bp(x)                    __builtin_popcount(x)
#define    endl                     "\n"
int power(int x, int y, int p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0)  
    {     
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res; 
}

int32_t main()
{
    speed upp
    int x,n;
    cin>>n;
    f(i,0,1000)
    {
        x=n+ i*i*i*i*i;
        int l=-3000,r=3000;
        while(l<=r)
        {
            int y=(l+r)>>1;
            if(y*y*y*y*y == x)
            {
                cout<<y<<" "<<i;
                exit(0);
            }
            else if(y*y*y*y*y > x)
                r=y-1;
            else    
                l=y+1;
        }
        x=n- i*i*i*i*i;
        l=-3000;
        r=3000;
        while(l<=r)
        {
            int y=(l+r)>>1;
            if(y*y*y*y*y == x)
            {
                cout<<y<<" "<<-i;
                exit(0);
            }
            else if(y*y*y*y*y > x)
                r=y-1;
            else    
                l=y+1;
        }
    }
}


Measured memory_bytes: 3640
#include<stdio.h>
#include<math.h>
#include<string.h>

int main(){
	
	char flag[1000001];
	memset(flag,'0',1000001);
	flag[1000000]='\0';
	
	
	int s;
	int i=0;
	scanf("%d",&s);
	flag[s]=1;
	for(i=2;;i++){
		if(s%2==0){
			s/=2;
			//puts("a");
		}else{
			s=(s*3+1);
			//puts("b");
		}
		
		if(flag[s]=='0'){
			flag[s]=1;
			//puts("c");
		}else{
			printf("%d\n",i);
			//puts("d");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
import sys
# import time
input = lambda: sys.stdin.readline().rstrip()
r, c, k = map(int, input().split())
# dp = [[[0] * 3 for _ in range(c + 5)] for _ in range(r + 5)]
pt = [[0 for _ in range(c + 5)] for _ in range(r + 5)]

for i in range(k):
    r1, c1, v = map(int, input().split())
    # dp[r1][c1][0] = v
    pt[r1][c1] = v

# start = time.time()
a = 0


def solve():
    memo = [[0] * 4 for _ in range(c + 1)]
    prev = [[0] * 4 for _ in range(c + 1)]
    for i in range(1, r + 1):
        memo, prev = prev, memo
        for j in range(1, c + 1):
            V = pt[i][j]
            memo[j][0] = max(prev[j][3], memo[j - 1][0])
            memo[j][1] = max(memo[j][0] + V, memo[j - 1][1])
            memo[j][2] = max(memo[j][1], memo[j - 1][1] + V, memo[j - 1][2])
            memo[j][3] = max(memo[j][2], memo[j - 1][2] + V, memo[j - 1][3])

            # dp[i][j][0] = max(dp[i - 1][j][2] + V, dp[i][j - 1][0])
            # dp[i][j][1] = max(dp[i][j - 1][0] + V, dp[i][j - 1][1],
            #                   dp[i][j][0])
            # dp[i][j][2] = max(dp[i][j - 1][1] + V, dp[i][j - 1][2],
            #                   dp[i][j][1])

    # process_time = time.time() - start

    # print(process_time)

    # print(dp[r][c][2])
    return memo[-1][3]





if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 149468
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define eps 1e-7
#define int ll
using pii = pair <int, int>;

deque<char> d;
string s;
int32_t main()
{
    usecppio
    cin >> s;
    for (auto it:s)
        d.push_back(it);
    int q; cin >> q;
    bool rev = false;
    while(q--)
    {
        int t; cin >> t;
        if (t == 1)
            rev = !rev;
        else
        {
            int f; string c;
            cin >> f >> c;
            if (f == 1)
            {
                if (rev)
                    d.push_back(c[0]);
                else d.push_front(c[0]);
            }
            else
            {
                if (rev)
                    d.push_front(c[0]);
                else
                    d.push_back(c[0]);
            }
        }
    }
    if (rev)
    {
        reverse(all(d));
    }
    for (auto it:d)
    {
        cout << it;
    }
    cout << '\n';
}

Measured memory_bytes: 976
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200000)


def read():
    H, W = map(int, input().strip().split())
    C = []
    for i in range(H):
        c = input().strip()
        C.append(c)
    return H, W, C


def solve(H, W, C):
    for c in C:
        print(c)
        print(c)


if __name__ == '__main__':
    inputs = read()
    solve(*inputs)


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

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

	for (;;){
		int N;
		cin >> N;
		if (N == 0) break;

		int ans = 0;
		for (int a = 2; a <= N / 2 + 1; a++){
			for (int b = 1; b <= a - 1; b++){
				if (a * (a + 1) - b * (b - 1) == 2 * N) ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include<stdio.h>
int main(){
	int a,b,c,i,j,n;
	int Z,d[100],iwm=0;
	scanf("%d",&n);
	scanf("%d%d",&a,&b);
	scanf("%d",&c);
	for(i=0;i<n;i++)scanf("%d",&d[i]);
	for(i=0;i<n;i++){
		for(j=i;j<n;j++){
			if(d[i]<d[j]){
				Z=d[i];
				d[i]=d[j];
				d[j]=Z;
			}
		}
	}
	for(i=1;i<=n;i++){
		Z=0;
		for(j=0;j<i;j++)Z=Z+d[j];
		Z=(c+Z)/(a+b*i);
		if(iwm<Z)iwm=Z;
	}
	printf("%d\n",iwm);
	return 0;
}


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

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

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

    cout << max(a + b, max(a - b, a * b)) << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <string>
#include <numeric>
#include <algorithm>
using namespace std;
using iL = long long;
using iUL = unsigned long long;
using dL = long double;
#define rep( NAME, NUM ) for( int NAME = 0; NAME < ( NUM ); ++NAME )
#define brep( NAME, NUM ) for( int NAME = ( NUM ) - 1; NAME >= 0; --NAME )

int main()
{
    //----------------
int n, t, a;
    cin >> n >> t >> a;
    vector<int> h( n, 0 );
    rep( i, n ) cin >> h[i];
    
    int idx = -1;
    float min = 10000000.f;
    rep( i, n )
    {
        float b = float( t ) - float( h[i] ) * 0.006f;
        b = abs( a - b );
        if( min > b )
        {
            idx = i;
            min = b;
        }
    }
    cout << idx + 1 << endl;

    //----------------
    return 0;
}

Measured memory_bytes: 256
import sys


def make753(r, l):
  if r == 1:
    return l
  else:
    l = l + [i*10 + 3 for i in l] + [i*10 + 5 for i in l] + [i*10 + 7 for i in l]
    l = list(set(l))
    return make753(r-1, l)

def main():
  input = sys.stdin.readline
  n = str(input().strip())
  R = len(n)
  N = int(n)
  l = [7, 5, 3]
  L = make753(R, l)
  ans = 0
  for i in L:
    if i > N:
      continue
    elif set([int(j) for j in str(i)]) != set([7, 5, 3]):
      continue
    else:
      ans += 1
  print(ans)


if __name__ == '__main__':
  main()

Measured memory_bytes: 7732
#include<iostream>
#include<string>
using namespace std;
int main(void){
  string s;
  cin >> s;
  int a = 0;
  if(s[0]=='o') a++;
  if(s[1]=='o') a++;
  if(s[2]=='o') a++;
  cout<<700 + a*100<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a[ohara],b[ohara],c,d,tmp[ohara],tmpp,m,h,w,x,y,sum,pos[ohara],k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)sum+=a[i];
    rep(i,n)cnt+=b[i];
    if(sum<cnt){
        Cout(-1);
        return 0;
    }
    rep(i,n-1){
        tmp[i]=b[i];
        sum-=b[i];
    }
    tmp[n-1]=sum;
    tmpp=sum-b[n-1];
    rep(i,n-1){
        pos[i]=tmp[i]-a[i];
    }
    sort(pos,pos+n-1);
    reverse(pos,pos+n-1);
    ans=n;
    c=0;
    d=tmpp;
    rep(i,n-1){
        //Cout(pos[i]);
        if(pos[i]>0){
            c=1;
            continue;
        }
        if(pos[i]*-1<=tmpp&&tmpp>=0){
            tmpp-=pos[i]*-1;
            ans--;
            c=1;
        }
    }
    //cout<<sum<<" "<<d<<" "<<tmpp<<" "<<a[n-1]<<"\n";
    if(sum-(d-tmpp)-a[n-1]>=0&&c==1&&a[n-1]>=b[n-1])ans--;
    Cout(ans);
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int x = 1;
  for (int i = 0;i < N;i++) {
    if (x * 2 < x + K) {
      x *= 2;
    }
    else {
      x += K;
    }
  }
  cout << x << endl;
}

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

using namespace std;
using ll = long long;

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

  int n, m;
  cin >> n >> m;

  auto cmp = [](auto &p1, auto &p2) {
    if (p1.first > p2.first) {
      return true;
    } else if (p1.first < p2.first) {
      return false;
    } else {
      return p1.second < p2.second;
    }
  };
  priority_queue<pair<int, ll>, vector<pair<int, ll>>, decltype(cmp)> q1(cmp);

  for (int i = 0; i < n; i++) {
    int a;
    ll b;
    cin >> a >> b;
    q1.push({a, b});
  }

  ll ans = 0;
  priority_queue<ll, vector<ll>, less<ll>> q2;
  for (int i = 1; i <= m; i++) {
    if (q1.empty() && q2.empty()) {
      continue;
    } else if (q1.empty()) {
      ans += q2.top();
      q2.pop();
    } else if (q2.empty()) {
      auto [a, b] = q1.top();
      if (a > i)
        continue;
      ans += b;
      q1.pop();
    } else {
      auto [a1, b1] = q1.top();
      auto b2 = q2.top();
      if (a1 <= i && b1 > b2) {
        ans += b1;
        q1.pop();
      } else {
        ans += b2;
        q2.pop();
      }
    }
    while (!q1.empty() && q1.top().first <= i) {
      q2.push(q1.top().second);
      q1.pop();
    }
  }
  cout << ans << endl;

  return 0;
}


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

const ll mod = 1000000007;

// Matrix Definition{{{

template< class T >
struct Matrix{
    vector< vector<T> > A;

    Matrix(){};
    Matrix( int n, int m ) {
        A.assign(n,vector<T>(m,0));
    };
    Matrix( int n ) {
        A.assign(n,vector<T>(n,0));
    };

    int height() const {
        return (A.size());
    }

    int width() const {
        return (A[0].size());
    }

    inline vector<T> &operator[]( int k ) {
        return (A.at(k));
    }

    inline const vector<T> &operator[]( int k ) const {
        return (A.at(k));
    }

    // 単位行列
    static Matrix E( int n ){
        Matrix mat(n);
        for( int i = 0; i < n; i++ ) mat[i][i] = 1;
        return mat;
    }

    Matrix &operator+=( const Matrix &B ){
        int n = height(), m = width();
        assert( n == B.height() && m == B.width() );
        for( int i = 0; i < n; i++ )
            for( int j = 0; j < m; j++ )
                (*this)[i][j] += B[i][j];
        return (*this);
    }

    Matrix &operator-=( const Matrix &B ){
        int n = height(), m = width();
        assert( n == B.height() && m == B.width() );
        for( int i = 0; i < n; i++ )
            for( int j = 0; j < m; j++ )
                (*this)[i][j] -= B[i][j];
        return (*this);
    }

    Matrix &operator*=( const Matrix &B ){
        int n = height(), m = B.width(), p = width();
        assert( p == B.height() );
        vector< vector<T> > C( n, vector<T>(m, 0) );
        for( int i = 0; i < n; i++ )
            for( int j = 0; j < m; j++ )
                for( int k = 0; k < p; k++ )
                    (C[i][j] += (*this)[i][k] * B[k][j])%=mod;
        A.swap(C);
        return (*this);
    }

    Matrix power( ll k ){
        Matrix B = Matrix::E(height());
        while( k > 0 ){
            if( k&1 ) B *= *this;
            *this *= *this;
            k >>= 1;
        }
        A.swap(B.A);
        return *this;
    }

    Matrix operator+(const Matrix &B ) const {
        return (Matrix(*this) += B );
    }
    Matrix operator-(const Matrix &B ) const {
        return (Matrix(*this) -= B );
    }
    Matrix operator*(const Matrix &B ) const {
        return (Matrix(*this) *= B );
    }

    void Print(){
        int n = height(), m = width();
        for( int i = 0; i < n; i++ ){
            printf ("[");
            for( int j = 0; j < m; j++ ){
                printf ("%lld%s", (*this)[i][j], j == m-1 ? "]\n" : "," );
            }
        }
    }

};

// }}}

int main() {

    int N;
    ll K;
    int x;

    cin >> N >> K;

    Matrix<ll> a(N);

    for( int i = 0; i < N; i++ ){
        for( int j = 0; j < N; j++ ){
            cin >> x;
            a[i][j] = x;
        }
    }

    a.power( K );

    ll ans = 0;
    for( int i = 0; i < N; i++ ){
        for( int j = 0; j < N; j++ ){
            ans += a[i][j];
            ans %= mod;
        }
    }

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


    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int s[100005];
int main()
{
	int n;
	while(scanf("%d",&n)==1)
	{
		for(int i=1;i<=n;i++)
		scanf("%d",&s[i]);
		long long a=0,b=0,sum=0;
		long long res=0,cnt=0;
		for(int i=1;i<=n;i++)
		{
			res+=s[i];
			if(i%2!=0)
			{
				if(res<=0)
				{
					a+=1-res;
					res=1;
				}
			}
			if(i%2==0)
			{
				if(res>=0)
				{
					a+=1+res;
					res=-1;
				}
			}
	    }
	    for(int i=1;i<=n;i++)
		{
			cnt+=s[i];
			if(i%2!=0)
			{
				if(cnt>=0)
				{
					b+=1+cnt;
					cnt=-1;
				}
			}
			if(i%2==0)
			{
				if(cnt<=0)
				{
					b+=1-cnt;
					cnt=1;
				}
			}
	    }
	    sum=min(a,b);
	    printf("%lld\n",sum);
	}
	return 0;
} 

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;
int L[10];

int maxl=0;
int sum=0;

int main(){
    cin>>N;
    rep(i,N){
        cin>>L[i];
        sum+=L[i];
        if(maxl<L[i]) maxl=L[i];
    }
    sum-=maxl;

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

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
        int h,m,s,S;
        scanf("%d",&S);
        
        h=S/3600;
        m=S%3600/60;
        s=S%3600%60;
        
        printf("%d:%d:%d\n",h,m,s);
        
        return 0;
}


Measured memory_bytes: 2080
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	int a , b;
	cin >> a >> b;
	int ans = (a*b) / __gcd(a,b);
	cout << ans;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int N;
int* A;

int main() {
  cin >> N;
  A = new int[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    for (int j = N - 1; j > i; j--) {
      if (A[j] < A[j-1]) {
        int tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
        cnt++;
      }
    }
  }
  
  // out
  cout << A[0];
  for (int i = 1; i < N; i++) {
    cout << " " << A[i];
  }
  cout << endl;

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <set>
using namespace std;
typedef pair<int, int> P;
int main(void){
    int n, a;
    vector<P> v;
    multiset<int> s;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a;
        s.insert(a);
    }
    for(int i=n;i>1;i--){
        auto itr1 = s.begin();
        auto itr2 = s.end();
        itr2--;
        int x = (*itr1), y = (*itr2);
        s.erase(itr2);
        s.erase(itr1);
        if(i == 2){
            v.push_back(P(y, x));
            s.insert(y-x);
        }else if(x > 0){
            v.push_back(P(x, y));
            s.insert(x-y);
        }else{
            auto itr3 = s.begin();
            if((*itr3) < 0){
                v.push_back(P(y, x));
                s.insert(y-x);
            }else{
                v.push_back(P(x, y));
                s.insert(x-y);
            }
            
        }
    }
    auto itr = s.begin();
    cout << (*itr) << endl;
    for(int i=0;i<n-1;i++){
        cout << v[i].first << " " << v[i].second << endl;
    }
}


Measured memory_bytes: 7412
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N, a;
string k;
int G[300010];
bool used[300010];

bool comp(string a, string b) {
    if(a.length() != b.length()) return a.length() > b.length();
    else return a > b;
}

signed main() {
    cin >> N >> k; a = 0;
    rep(i,0,N) {
        int to; cin >> to;
        G[i] = to-1;
    }

    vector<int> v;
    int C = 0, T = 0;
    while(1) {
        used[a] = true;
        v.push_back(a);
        a = G[a];
        if(used[a]) break;
    }

    T = find(v.begin(), v.end(), a) - v.begin();
    C = v.size() - T;

    if(comp(k, to_string(T))) {
        int mo = 0;
        rep(i,0,k.length()) {
            mo = (mo * 10 + k[i] - '0') % C;
        }
        mo = (mo - (T % C) + C) % C;
        cout << v[T+mo] + 1 << endl;
    }
    else {
        int step = atoi(k.c_str());
        cout << v[step] + 1 << endl;
    }
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<string> v(h);
	REP(i, h)cin >> v[i];
	vvl dp(h, vl(w, 0));
	dp[0][0] = 1;
	REP(i, h) {
		REP(j, w) {
			if (i == 0 && j == 0)continue;
			ll t = 0;
			if (v[i][j] == '#')continue;
			if (i > 0 && v[i - 1][j] == '.')t += dp[i - 1][j];
			if (j > 0 && v[i][j - 1] == '.')t += dp[i][j - 1];
			dp[i][j] = t % MOD;
		}
	}
	cout << dp[h - 1][w - 1] << endl;
}

Measured memory_bytes: 9216
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N;cin>>N;
    int ans=0;
    vector<int> v(N,0);
    vector<int> c(N,0);
    REP(i,N)cin>>v[i];
    REP(i,N)cin>>c[i];
    REP(i,N){
        if(v[i]-c[i]>0){
            ans+=v[i]-c[i];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import heapq
N, M = map(int, input().split())
Alist = list(map(int, input().split()))

q = []
for a in Alist:
    heapq.heappush(q, -a)

for i in range(M):
    m = heapq.heappop(q)
    heapq.heappush(q, -((-m)//2))

print(-sum(q))

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

signed main(){
  
  int N, K;
  int p[1005];
  
  cin >> N >> K;
  
  for(int i=0;i<N;i++) cin >> p[i];
  
  sort( p, p + N );
  
  int ans = 0;
  
  for(int i=0;i<K;i++) ans += p[i];
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3644