akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef vector< pii > vii;

#define ll          long long
#define ff          first
#define ss          second
#define pb          push_back
#define mkp         make_pair
#define sz          size()

#define forf(a,b,c)    for(int i=a;i<=b;i+=c)
#define forr(a,b,c)    for(int i=a;i>=b;i-=c)
#define all(a)      a.begin(),a.end()
#define mem(a,b)    memset(a,b,sizeof(a))
#define pi          2*acos(0.0)
#define End         return 0;
#define nl endl

#define scan1(a)    scanf("%d",&a)
#define scan2(a,b)  scanf("%d %d",&a,&b)
#define scan3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define scanl(a)    scanf("%lld",&a)
#define scanll(a,b) scanf("%lld %lld",&a,&b)
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)

#define print1(a)    printf("%d",a)
#define print2(a,b)  printf("%d %d",a,b)
#define print3(a,b,c)  printf("%d %d %d",a,b,c)
#define printl(a)    printf("%lld",a)
#define printll(a,b) printf("%lld %lld",a,b)
#define printlll(a,b,c) printf("%lld %lld %lld",a,b,c)

#define MAXN        100000007
#define INF 0x3f3f3f3f
bool mark[100005];vi prime;
void seive(ll N){for(int i=2;i<=N;i++){if(mark[i]==false){prime.pb(i);for(int j=i+i;j<N;j+=i)mark[j]=true;}}}
//freopen("input.txt", "r", stdin);

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   ll n;
   cin>>n;
   n--;
   ll res=(n*n+n)/2;
   cout<<res<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

struct mint {
    lint v;
    lint _mod;
    mint() : v(0) {}
    mint(signed v, lint _mod = mod) : v(v), _mod(_mod) {}
    mint(lint t, lint _mod = mod) : _mod(_mod) {
        v = t % _mod;
        if (v < 0)
            v += _mod;
    }

    mint pow(lint k) {
        mint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static mint add_identity() { return mint(0); }
    static mint mul_identity() { return mint(1); }
    mint inv() { return pow(_mod - 2); }

    mint &operator+=(mint a) {
        v += a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator-=(mint a) {
        v += _mod - a.v;
        if (v >= _mod)
            v -= _mod;
        return *this;
    }
    mint &operator*=(mint a) {
        v = v * a.v % _mod;
        return *this;
    }
    mint &operator/=(mint a) { return (*this) *= a.inv(); }

    mint operator+(mint a) const { return mint(v) += a; };
    mint operator-(mint a) const { return mint(v) -= a; };
    mint operator*(mint a) const { return mint(v) *= a; };
    mint operator/(mint a) const { return mint(v) /= a; };

    mint operator-() const { return v ? mint(_mod - v) : mint(v); }

    bool operator==(const mint a) const { return v == a.v; }
    bool operator!=(const mint a) const { return v != a.v; }
    bool operator<(const mint a) const { return v < a.v; }
};
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, m;
    cin >> n >> m;
    vector<lint> x(n), y(m);
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> y[i];
    }
    mint hol = 0, ver = 0;
    for (int i = 1; i < n; ++i) {
        mint left  = i;
        mint right = n - i;
        mint width = x[i] - x[i - 1];
        hol += width * left * right;
    }
    for (int i = 1; i < m; ++i) {
        mint left  = i;
        mint right = m - i;
        mint width = y[i] - y[i - 1];
        ver += width * left * right;
    }
    cout << hol * ver << "\n";
    return 0;
}

Measured memory_bytes: 1792
h,w=map(int,input().split())
A=[]
for i in range(h):
    a=list(input())
    if "#" in a:
        A.append(a)
    else:
        h-=1

num=[]
for i in range(w):
    for j in range(h):
        if A[j][i]=="#":
            num.append(i)
            break
for i in range(h):
    for j in num:
        print(A[i][j],end="")
    print()


Measured memory_bytes: 4596
// AtCoder ABC121: C - Energy Drink Collector
// 2019.9.9 bal4u
// Template for Online Contest

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef long long ll;

#define gc() getchar()
#define pc(c) putchar(c)

int in() {  // 整数の入力
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

ll inL() {  // long long 整数の入力
	ll n = 0; int c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n) { // 整数の表示
	int i; char b[30];
	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

void outL(ll n) { // 整数の表示
	int i; char b[30];
	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

int ins(char *s) { // 文字列の入力
	char *p = s--;
	do *++s = gc();
	while (*s > ' ');
	*s = 0;
	return s - p;
}

void outs(char *s) {  // 文字列の表示
	while (*s) pc(*s++);
}

#define MIN(a,b)  ((a)<=(b)?(a):(b))
#define MAX(a,b)  ((a)>=(b)?(a):(b))
#define ABS(a)    ((a)>=0?(a):-(a))
inline static int chmax(int *a, int b) { if (*a < b) *a = b; }
inline static ll  chmaxL(ll *a, int b) { if (*a < b) *a = b; }
inline static int chmin(int *a, int b) { if (*a > b) *a = b; }
inline static ll  chminL(ll *a, int b) { if (*a > b) *a = b; }

typedef struct { int a, b; } T;
T t[100005];
int N, M;
ll ans;

int cmp(const void *u, const void *v) {	return ((T *)u)->a - ((T *)v)->a; }

int main()
{
	int i, s;

	N = in(), M = in();
	for (i = 0; i < N; i++) t[i].a = in(), t[i].b = in();
	qsort(t, N, sizeof(T), cmp);
	s = 0; for (i = 0; i < N; i++) {
		if (s + t[i].b <= M) ans += (ll)t[i].a * t[i].b, s += t[i].b;
		else { ans += (ll)(M-s)*t[i].a; break; }
	}
	outL(ans);
	return 0;
}


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


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

int n;P p[210000];
signed main(){
  cin>>n;rep(i,n)cin>>p[i].second>>p[i].first;
  sort(p,p+n);
  int x = 0;
  rep(i,n){
    x += p[i].second;
    if(x > p[i].first){
      cout << "No" << endl;return 0;
    }
  }
  cout << "Yes" << endl;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N; cin >> N;
    if(N == 3) cout << "2 5 63" << endl;
    else{
        vector<int> ans;
        ans.push_back(3); ans.push_back(9); ans.push_back(2); ans.push_back(4);
        for(int i = 5; i <= min(15002, N); i++){
            if(i % 3 == 2){
                ans.push_back(ans.back()+2);
            }
            else if(i % 3 == 0){
                int val = ans.back();
                ans.pop_back();
                ans.push_back(val+2);
                ans.push_back(val+4);
            }
            else{
                ans.insert(ans.end()-2, ans.back()-4);
            }
        }
        if(N > 15002 && N % 2 == 1) ans.pop_back();
        int val = 9;
        for(int i = ans.size()+2; i <= N; i+=2){
            ans.push_back(val+6);
            ans.push_back(val+12);
            val += 12;
        }
        rep(i, ans.size()) cout << ans[i] << " "; cout << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
	int a, b, c, tmp;
	cin >> a >> b >> c;

	if(a > b){
		tmp = a;
		a = b;
		b = tmp;
	}
	if(b > c){
		tmp = b;
		b = c;
		c = tmp;
	}
	if(a > b){
		tmp = a;
		a = b;
		b = tmp;
	}

	cout << a << " " << b << " " << c << endl;

	return 0;
}

Measured memory_bytes: 1164
import java.awt.Point;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			
			Point p = new Point(x, y);
			if (p.distance(0, 0) <= d)
				cnt++;
		}
		
		System.out.println(cnt);
		
		sc.close();
	}
}


Measured memory_bytes: 48780
#include<bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pii pair<ll,ll>
#define mod 1000000007 //998244353
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fb(i,a,b) for(ll i=a;i>b;i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
#define pq priority_queue<ll>
#define pqr priority_queue<ll,vector<ll>,greater<ll>()>
using namespace std;
ll pow_mod(ll a,ll b)
{
	ll res=1;
	while(b!=0)
	{
		if(b&1)
		{
			res=(res*a)%mod;
		}
		a=(a*a)%mod;
		b/=2;
	}
	return res;
}
void solve()
{
  ll n,m;
  
  cin>>n>>m;
  
  vector<ll>adj[n+1];
  
  for(ll i=0;i<m;i++){
      ll x,y;
      cin>>x>>y;
      
      adj[x].pb(y);
      adj[y].pb(x);
  }
  
  bool mark[n+1];
  
  memset(mark,false,sizeof(mark));
  
  ll ans=0;
  ll sz=0;
  function<void(ll,ll)>dfs=[&](ll s,ll p){
    sz++;
    mark[s]=true;
    
    for(auto a:adj[s]){
        if(!mark[a]){
            dfs(a,s);
        }
    }
  };
  
  for(ll i=1;i<=n;i++){
      if(!mark[i]){
          sz=0;
          dfs(i,-1);
          ans=max(ans,sz);
         // ans++;
      }
  }
  cout<<ans<<endl;
}
int32_t main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     
//Start from Here.

  ll t;
  t=1;
 // cin>>t;
  while(t--)
  solve();
  
//Good Bye!
    return 0;
}

Measured memory_bytes: 30416
def main():
  N, K, Q = map(int, input().split()) # スペース区切り入力
  A = [int(input()) for i in range(Q)]  # 1つずつ連続入力
  # print(N)
  # print(A)
  # 参加者はN人、Kポイントを持つ
  # A[i]は正解者の番号
  # 全員からQ引いて、A[i]番目の参加者に1を足す
  # 正ならYes、else No
  first = [K for i in range(N)]
  # print(first)
  second = list(map(lambda x: x - Q, first))
  # print(second)
  for i in range(Q):
    second[A[i]-1] += 1

  for i in range(N):
    print('Yes') if second[i] > 0 else print('No')


if __name__ == '__main__':
  main()


Measured memory_bytes: 12592
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        var s = Console.ReadLine().Trim();
        if (n == 1 ) { Console.WriteLine(1); goto exit; }
        var a = s.ToCharArray();
        var b = new List<int>();
        if (a[0] == '0') b.Add(0);
        var t = a[0];
        var count = 1;
        for (int i = 1; i < n; i++)
        {
            if (a[i] == t) count++;
            else
            {
                b.Add(count);
                count = 1;
            }
            t = a[i];
        }
        b.Add(count);
        if (a[n - 1] == '0') b.Add(0);
        var x = 2 * k + 1;
        for (int i = 0; i < x; i++) b.Add(0);
        var bc = b.Count();
        var c = new int[bc+ 1];
        for (int i = 1; i < bc + 1; i++)
            c[i] = c[i - 1] + b[i - 1];
        var ans = 0;
        for (int i = 0; i <= c.Length - x -1 ; i+=2)
        {
            var tt = c[i + x ] - c[i];
            ans = Max(ans, tt);
        }
        Console.WriteLine(ans);
        exit:;
    }
}

Measured memory_bytes: 14176
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author yoovraj.shinde
 */
public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int n  = in.nextInt();
        int[] mem = new int[n];
        for (int i = 0 ; i < n-1; i++) {
            mem[Integer.parseInt(in.next()) - 1 ] ++;
        }
        for (int i : mem) {
            System.out.println(i);
        }
    }

}


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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m, x;
    cin >> n >> m >> x;
    int c[n];
    int a[n][m];
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    int ans = INT_MAX;
    for (int mask = 0; mask < (1 << n); mask++) {
        vi cur(m, 0);
        int cost = 0;
        for (int i = 0; i < n; i++) {
            if ((mask >> i) & 1) {
                cost += c[i];
                for (int j = 0; j < m; j++) {
                    cur[j] += a[i][j];
                }
            }
        }
        bool can = true;
        for (int j = 0; j < m; j++) {
            if (cur[j] < x) {
                can = false;
                break;
            }
        }
        if (can) {
            ans = min(ans, cost);
        }
    }
    if (ans == INT_MAX) ans = -1;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define PI            3.14159265
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),v.rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>
#define msi           map<string,int>

int solve(){
	int a,b,c; cin>>a>>b>>c;
	cout<<min({a+b,b+c,c+a});
}

signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define length size()
#define int long long
#define ll long long
const int mod= 1000000007;

template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
signed main(void){
    int n;
    cin >> n;
    int ans=1;
    for(int i=0;i<n;i++){
        ans *=10;
        ans %=mod;
    }
    int p = 1;
    rep(i,n){
        p*=9;
        p %= mod;
    }
    p*=2;
    p%=mod;
    int q = 1;
    rep(i,n){
        q *= 8;
        q %= mod;
    }
    ans -= p;
    if(ans<0) ans+= mod;
    ans += q;
    ans %= mod;
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#define min(a,b) (a<b)?a:b
#define max(a,b) (a>b)?a:b
#define ll long long int
#define BIG 1e9
using namespace std;

int main() {
	ll dp[200000],h[200000],N;
	cin>>N;
	for(int i=0; i<N; i++)cin>>h[i];
	dp[0] = 0;
	dp[1] = abs(h[1]-h[0]);
	for(int i=2; i<N; i++){
		dp[i] = min(min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])),dp[i-2]+abs(h[i]-h[i-1])+abs(h[i-1]-h[i-2]));
	}
	cout<<dp[N-1]<<endl;
	return 0;
}

Measured memory_bytes: 3072
#include "bits/stdc++.h"
using namespace std;
#define ALL(x)x.begin(),x.end()
int main() {
	int N;
	scanf("%d", &N);
	int O = N;
	N *= 100;
	N /= 108;
	if ((N - 1) * 108 / 100 == O) {
		printf("%d\n", N - 1);
		return 0;
	}
	if (N * 108 / 100 == O) {
		printf("%d\n", N);
		return 0;
	}
	if ((N + 1) * 108 / 100 == O) {
		printf("%d\n", N + 1);
		return 0;
	}
	puts(":(");
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.Reader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;

/**
 * The Java template file for AtCoder online judge.
 */
public class Main {

  private static FastScanner scanner;
  private static PrintWriter printer;

  public static void solve() {
    int n = scanner.nextInt();
    int[][] match = new int[n][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        match[i][j] = scanner.nextInt();
      }
    }
    long[] dp = new long[1 << n];
    dp[0] = 1;
    for (int mask = 1; mask < (1 << n); mask++) {
      int man = countSetBits(mask) - 1;
      for (int female = 0; female < n; female++) {
        if (match[man][female] == 1 && (mask & (1 << female)) != 0) {
          dp[mask] = addModulo(dp[mask], dp[mask ^ (1 << female)], MOD);
        }
      }
    }
    printer.println(dp[(1 << n) - 1]);
  }

  private static int countSetBits(int mask) {
    int sum = 0;
    while (mask > 0) {
      if ((mask & 1) != 0) {
        sum++;
      }
      mask >>>= 1;
    }
    return sum;
  }

  private static long MOD = (long)1e9 + 7;

  private static long addModulo(long a, long b, long mod) {
    long sum = a + b;
    if (sum >= mod) {
      sum -= mod;
    }
    return sum;
  }

  public static void main(String[] args) {
    scanner = new FastScanner();
    printer = new PrintWriter(System.out);
    solve();
    printer.flush();
  }

  private static class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(Reader in) {
      br = new BufferedReader(in);
    }

    public FastScanner() {
      this(new InputStreamReader(System.in));
    }

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

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

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

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

    public String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

    public int[] readIntArray(int size) {
      int[] ret = new int[size];
      for (int i = 0; i < size; i++) {
        ret[i] = nextInt();
      }
      return ret;
    }
  }
}


Measured memory_bytes: 42452
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
#define Maxn 100
int n,m;
int bel[Maxn+5];
int a[Maxn+5][Maxn+5];
bool edge[Maxn+5][Maxn+5],vis[Maxn+5];
vector<int> vec[Maxn+5][Maxn+5];
bool dfs(int x){
	for(int i=1;i<=n;i++){
		if(!vis[i]&&edge[x][i]){
			vis[i]=1;
			if(bel[i]==0||dfs(bel[i])){
				bel[i]=x;
				return 1;
			}
		}
	}
	return 0;
}
void swp(int &a,int &b){
	int t=a;
	a=b;
	b=t;
}
int main(){
	scanf("%d%d",&n,&m);
	int x;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			scanf("%d",&x);
			vec[i][(x-1)/m+1].push_back(x);
		}
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				edge[j][k]=(!vec[j][k].empty());
			}
		}
		memset(bel,0,sizeof bel);
		for(int j=1;j<=n;j++){
			memset(vis,0,sizeof vis);
			dfs(j);
		}
		for(int j=1,k;j<=n;j++){
			k=bel[j];
			a[k][i]=vec[k][j].back();
			vec[k][j].pop_back();
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			printf("%d ",a[i][j]);
		}
		puts("");
	}
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			for(int k=j+1;k<=n;k++){
				if(a[j][i]>a[k][i]){
					swp(a[j][i],a[k][i]);
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			printf("%d ",a[i][j]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 896
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e16
using namespace std;
typedef pair<ll, ll> P;


int main(void) {
	string s, t;
	cin >> s >> t;
	map<char, int>a, b;
	vector<int>x, y;
	for (int i = 0;i < s.length();i++) a[s[i]]++;
	for (int i = 0;i < t.length();i++) b[t[i]]++;
	for (char l = 'a';l <= 'z';l++)x.push_back(a[l]);
	for (char l = 'a';l <= 'z';l++)y.push_back(b[l]);
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	for (int i = 0;i < (int)x.size();i++) {
		if (x[i] != y[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

template<class T> T largest_rectangle (vector<T> a) {
	using value_type = T;
    a.emplace_back(0);
    int n = a.size();
	value_type ret = 0;
    stack<pair<value_type, int>> sta;
    for (int i = 0; i < n; i++) {
        if (sta.empty()) {
			sta.emplace(a[i], i);
        } else if (sta.top().first < a[i]) {
			sta.emplace(a[i], i);
        } else if (sta.top().first > a[i]) {
            int idx = i;
            while (!sta.empty()) {
                if (sta.top().first < a[i]) break;
                value_type h; int t;
				tie(h, t) = sta.top();
				sta.pop();
                value_type s = h * (i - t);
				idx = t;
                if (ret < s) ret = s;
            }
            sta.emplace(a[i], idx);
        }
    }
    return ret;
}


int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<int>> a(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}
	
	int ans = 0;
	vector<int> hist(w, 0);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j]) hist[j] = 0;
			else hist[j]++;
		}
		ans = max(ans, largest_rectangle(hist));
	}
	
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 10460
def main():
    A, B, K = map(int, input().split())
    results = calc(A, B)
    print(results[K - 1])

def calc(A, B):
    results = []
    for i in range(min(A, B) + 1, 0, -1):
        if A % i == 0 and B % i == 0:
            results.append(i)
    return results

if __name__ == '__main__':
    main()

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

int main(void) {
    int A,B,C;cin>>A>>B>>C;
    vector<int> vc;
    vc.push_back(A);
    vc.push_back(B);
    vc.push_back(C);
    int mx = -1;
    do {
        int a = vc.at(0) + (vc.at(1) * 10 + vc.at(2));
        int b = (vc.at(0) * 10 + vc.at(1)) + vc.at(2);
        if (mx < max(a, b)) mx = max(a, b);
    } while (next_permutation(vc.begin(), vc.end()));
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;

  if( (a+b) >= c) printf("Yes\n");
  else printf("No\n");

  return 0;
  
}


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

int main (void)
{
    int a, b, c, k, max;

    scanf("%d %d %d", &a, &b, &c);
    scanf("%d", &k);

    max = (a > b) ? a : b;
    max = (max > c) ? max : c;

    printf("%d\n", a + b + c + max * (int)pow((double)2, (double)k) - max);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
	int a,b; cin>>a>>b;
	if(a<=5){
		cout<<0<<endl;
	}else if(a<=12){
		cout<<b/2<<endl;
	}else{
		cout<<b<<endl;
	}
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define ull unsigned long long 
#define ld long double
#define ui unsigned int 
using namespace std;
int main()
{
	int* arr = new int[10];
	for (int i = 0; i < 10; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + 10,greater<int>());
	cout << arr[0] << endl << arr[1] << endl << arr[2] << endl;
}




Measured memory_bytes: 3100
N = int(input())
S = [list(input()) for i in range(N)]

for s in S:
    s.sort()

S.sort()

cnt = 1
ans = 0
tmp = []

for s in S:
    if s == tmp:
        cnt += 1
    else:
        tmp = s
        ans += cnt * (cnt - 1) // 2
        cnt = 1

ans += cnt * (cnt - 1) // 2

print(ans)


Measured memory_bytes: 24652
#include<iostream>
#include<string>
#include<algorithm>
#include<atcoder/dsu>
using namespace std;
using namespace atcoder;

using ll = long long;

ll N, M;
ll A[110000];
ll B[110000];

int main(void){

    cin >> N >> M;
    for (int i = 1; i <= M;i++) cin >> A[i] >> B[i];

    ll ans = 0;

    dsu d(N);

    for (int i = 1; i <= M;i++){
        d.merge(A[i]-1,B[i]-1);
    }

    vector<vector<int>> dg = d.groups();

    ans = dg.size();
    ans--;

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 9068
from sys import stdin

N = int(stdin.readline().rstrip())
d = [int(stdin.readline().rstrip()) for _ in range(N)]
d.sort()

ans = 1
prev_mochi = d[0]
for i in range(1, len(d)):
    if d[i] > prev_mochi:
        ans += 1

    prev_mochi = d[i]

print(ans)


Measured memory_bytes: 2940
R=range
def F(a,b):A=len(a);r=[all([len(set([a[i+j],b[j],'?']))<3for j in R(min(A-i,len(b)))])for i in R(A)];return r+[1]
def Z(X):
 i,j,k=X;A,B,C=map(len,[S[i]for i in X]);q=1e5
 for l in R(A+1):
  if M[i][j][l]:
   for r in R(l,A+B+1):
    if(B<r-l or M[j][k][r-l])*M[i][k][min(A,r)]:q=min(q,max(A,l+B,r+C))
 return q
T=R(3)
S=[input()for i in T]
M=[[F(S[i],S[j])for j in T]for i in T]
from itertools import *;print(min([Z(i)for i in permutations(T)]))

Measured memory_bytes: 54236
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
ll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans.sz+1;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol(const vector<int>& v1, 
               const vector<int>& v2){ 
 return v1[0] < v2[0]; } 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }

void solve()
{
	ll l,r,d;
	cin>>l>>r>>d;
	ll ans=(r/d)-((l-1)/d);
	cout<<ans;
	return;        
}       
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3600
import numpy as np
n, d = map(int, input().split())
x = [np.array(list(map(int, input().split()))) for _ in range(n)]
cnt = 0
for i in range(len(x)-1):
  x_i = x[i]
  for j in x[i+1:]:
    m = x_i - j
    if float(np.linalg.norm(m)).is_integer():
      cnt += 1
print(cnt)


Measured memory_bytes: 27232
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct Point {
    int x,y; ll h;
};

int main(){
    int N; cin >> N;
    vector<Point> vp(N);
    for (int i = 0; i < N; i++){
        int x,y; ll h; cin >> x >> y >> h;
        vp[i] = {x,y,h};
    }

    for (int i = 0; i <= 100; i++){
        for (int j = 0; j <= 100; j++){
            int index = 0;
            while (vp[index].h == 0){
                index++;
            }
            ll H = vp[index].h + abs(i-vp[index].x) + abs(j-vp[index].y);
            bool flg = true;
            for (int k = 0; k < N; k++){
                int height = max(H-abs(i-vp[k].x)-abs(j-vp[k].y),0LL);
                if (height != vp[k].h || H < vp[k].h){
                    flg = false;
                }
            }
            if (flg && H != 0){
                cout << i << " " << j << " " << H << endl;
                return 0;
            }
        }
    }
}

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

using namespace std;

const int MAXL=100111;
const long long MOD=1000000007LL;

long long sr;
long long sum(long long a, long long b){
	sr=a+b;
	if(sr>=MOD)	sr-=MOD;
	return sr;
}

long long mul(long long a, long long b){
	return a*b%MOD;
}

string input;
int Num[MAXL];
int L;

int unCode(char c){
	if(c=='A')	return 1;
	if(c=='B')	return 2;
	if(c=='C')	return 3;
	return 4;
}

long long DP[4], Sum[4];

int main(){
	ios_base::sync_with_stdio(false);
	
	cin >> input;
	L=input.length();
	for(int i=1;i<=L;++i)
		Num[i]=unCode(input[i-1]);
	
	Sum[0]=1LL;
	for(int i=1;i<=L;++i){
		if(Num[i]==4){
			for(int k=1;k<=3;++k)
				DP[k]=Sum[k-1];
			for(int k=0;k<=3;++k){
				Sum[k]=mul(3LL, Sum[k]);
				Sum[k]=sum(Sum[k], DP[k]);
			}
		}
		else{
			DP[Num[i]]=Sum[Num[i]-1];
			Sum[Num[i]]=sum(Sum[Num[i]], DP[Num[i]]);
		}
	}
	
	cout << Sum[3] << endl;
	
	return 0;
}

Measured memory_bytes: 848
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
int read()
{
    int s=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
    return s*f;
}
ll arr[MAXN];
ll gcd(ll a,ll b)
{
    return (b==0?a:gcd(b,a%b));
}
ll lcm(ll a,ll b)
{
    return (a*b)/(gcd(a,b));
}
int main()
{
    ll n,m;
    while(cin>>n>>m)
    {
        for(int i=1;i<=n;i++)cin>>arr[i],arr[i]/=2;
        ll lc=1ll;
        for(int i=1;i<=n;i++)
        {
            lc=lcm(lc,arr[i]);
        }
        if(lc>m)
        {
            cout<<0<<endl;continue;
        }
        bool flag=false;
        for(int i=1;i<=n;i++)
        {
            if(lc/arr[i]%2==0)
            {
                flag=true;break;
            }
        }
        if(flag)
        {
            cout<<0<<endl;continue;
        }
        ll ans=ll((m/lc+1)/2);
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
 int n=0,m=0,ans=0;
  scanf("%d%d",&n,&m);
  if(n>1){
    ans += n*(n-1)/2;
  }
  if(m>1){
    ans += m*(m-1)/2;
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>

using namespace std;

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

  bool ans = true;
  int one = 0;
  for (int i=0; i<4; i++) {
    if (p[i] > 2) ans = false;
    if (p[i] == 1) one++;
  }

  if (one > 2) ans = false;

  cout << ((ans)? "YES" : "NO") << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        char[] station = s.toCharArray();

        if (station[0] == 'A' & station[1] == 'A' & station[2] == 'A') {
            System.out.println("No");
        } else if (station[0] == 'B' & station[1] == 'B' & station[2] == 'B') {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

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

using namespace std;

#define EPS 1e-10

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}
 
    Point operator + (const Point &p)const{ return Point(x+p.x, y+p.y); }
    Point operator - (const Point &p)const{ return Point(x-p.x, y-p.y); }
    Point operator * (const double &k)const{ return Point(x*k, y*k); }
    Point operator / (const double &k)const{ return Point(x/k, y/k); }
};

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

double cross(const Point &a, const Point &b)
{
    return a.x*b.y - b.x*a.y;
}

double norm(const Point &p){
    return dot(p, p);
}

double abs(const Point &p)
{
    return sqrt(norm(p));
}

double dist(const Point &a, const Point &b)
{
    return sqrt(pow(a.x-b.x, 2) + pow(a.y-b.y, 2));
}

typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
    Vector a = p1 - p0, b = p2 - p0;
    if (cross(a, b) > EPS)  return +1;
    if (cross(a, b) < -EPS) return -1;
    if (dot(a, b) < -EPS)   return +2; 
    if (norm(a) < norm(b))  return -2;
    return +0;
}

struct Segment {
    Point s, t;
    Segment(){}
    Segment(Point s, Point t) : s(s), t(t) {}
};

#define curr(G,i) (G[i%G.size()])
#define next(G,i) (G[(i+1)%G.size()])
typedef vector<Point> Polygon;
typedef Segment Line;

Point crosspointLL(const Line &a, const Line &b)
{
    Vector va = a.t-a.s, vb = b.t-b.s;
    double d = cross(vb, va);
    if (abs(d) < EPS) return b.s;
    return a.s + va * cross(vb, b.t - a.s) * (1.0 / d);
}

Polygon convex_cut(const Polygon &pg, const Line &l)
{
    Polygon res;
    for (int i = 0; i < (int)pg.size(); i++) {
	Point cp = curr(pg,i), np = next(pg,i);
	if (ccw(l.s, l.t, cp) != -1) res.push_back(cp);
	if (ccw(l.s, l.t, cp)*ccw(l.s, l.t, np) < 0) {
	    res.push_back(crosspointLL(Line(cp, np), l));
	}
    }
    return res;
}

vector<Vector> normal_line_vector(const Line &l)
{
    vector<Vector> vs;
    Vector v = l.t - l.s, p = v / abs(v);
    vs.push_back(Point(-p.y, p.x));
    vs.push_back(Point(p.y, p.x));
    return vs;
}

vector<Line> translation(const Line &l, double d)
{
    vector<Vector> nlv = normal_line_vector(l);
    vector<Line> nl;
    nl.push_back(Line(l.s + nlv[0]*d, l.t + nlv[0]*d));
    nl.push_back(Line(l.s + nlv[1]*d, l.t + nlv[1]*d));
    return nl;
}

bool c(double d, const Polygon &pg)
{
    Polygon p = pg;
    for (int i = 0; i < (int)pg.size(); i++) {
        Line l(curr(pg, i), next(pg, i)), ll;
        vector<Line> nl = translation(l, d);
        ll = (ccw(l.s, l.t, nl[0].s) == 1 ? nl[0] : nl[1]);
        p = convex_cut(p, ll);
    }
    return (p.size() > 0);
}

int main()
{
    int n;
    while (cin >> n, n) {
        Polygon pg(n);
        for (int i = 0; i < n; i++) {
            cin >> pg[i].x >> pg[i].y;
        }

        double l = 0, r = 10000;
        for (int i = 0; i < 150; i++) {
            double mid = (l + r) / 2;
            if (c(mid, pg)) {
                l = mid;
            } else {
                r = mid;
            }
        }
        printf("%.8f\n", r);
    }
    return 0;
}

Measured memory_bytes: 1260
import sys
from collections import Counter

class UnionFind:

    def __init__(self, n):
        self.p = list(range(n))
        self.rank = [0] * n

    def find_root(self, x):
        if x != self.p[x]:
            self.p[x] = self.find_root(self.p[x])

        return self.p[x]

    def is_same(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def unite(self, x, y):
        u = self.find_root(x)
        v = self.find_root(y)

        if u == v:
            return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
        else:
            self.p[v] = u

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1


N, K, L = map(int, sys.stdin.readline().split())

uf1 = UnionFind(N)
uf2 = UnionFind(N)

for i in range(K):
    p, q = map(int, sys.stdin.readline().split())
    p, q = p - 1, q - 1
    uf1.unite(p, q)

for i in range(L):
    r, s = map(int, sys.stdin.readline().split())
    r, s = r - 1, s - 1
    uf2.unite(r, s)

cntr = Counter()

for i in range(N):
    u = uf1.find_root(i)
    v = uf2.find_root(i)

    cntr[(u, v)] += 1

ans = []

for i in range(N):
    u = uf1.find_root(i)
    v = uf2.find_root(i)

    ans.append(cntr[(u, v)])

print(*ans)

Measured memory_bytes: 50792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n + 1, 0);
    REP (i, 0, n) {
        sum[i + 1] = sum[i] + (s.substr(i, 2) == "AC");
    }
    REP(i, 0, q) {
        int l, r;
        cin >> l >> r;
        cout << sum[r - 1] - sum[l - 1] << endl;
    }
    return 0;
}


Measured memory_bytes: 1488
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    cout << t / a * b << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;


int main(){
    int a, b, c, K;
    scanf("%d%d%d%d", &a, &b, &c, &K);
    int cnt = 0;
    while(b <= a) ++cnt, b *= 2;
    while(c <= b) ++cnt, c *= 2;
    puts(cnt <= K ? "Yes" : "No");
}

Measured memory_bytes: 3684
#include <iostream>
#include <string>

int main()
{
  std::string S="";
  std::cin>>S;;
  
  for(size_t i=0;i<S.length();++i)
  {
    S.replace(i, 1, "x");
  }
  
  std::cout<<S<<std::endl;
  
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
_ = input()
a = [*map(int, input().split())]
q = int(input())
s = sum(a)
b = [[*map(int,input().split())] for _ in range(q)]
c = defaultdict(int)
for i in a:
    c[i]+=1
for i,j in b:
    s += (j-i)*c[i]
    c[j]+=c[i]
    c[i] = 0
    print(s)

Measured memory_bytes: 40248
#include<stdio.h>
#include<math.h>
int main(){
	int a,b,c,x;
	int s=0,cs=0,js=0;
	while(1){
		scanf("%d%d%d",&a,&b,&c);
		if(a>=b+c || b>=a+c || c>=a+b)break;
		if(c<a){x=c;c=a;a=x;}
		if(c<b){x=c;c=b;b=x;}
		a=a*a;
		b=b*b;
		c=c*c;
		x=c-a-b;
		if(x>0)cs++;
		if(x==0)s++;
		if(x<0)js++;
	}
	printf("%d %d %d %d\n",cs+s+js,s,js,cs);
	return 0;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 998244353;
const ull mod1 = 2e18 + 7;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 1e5 + 5;
int t;

int main()
{
	//freopen("in.txt", "r", stdin);
	int a, b;
	while (cin >> a >> b)
	{
		int ans = a - b * 2;
		if (ans < 0)ans = 0;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3532
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
ll n, m;
vector<vector<int>>graph(n);
vector<int>color(n);//各頂点の色
bool dfs(int v, int c) {
	color[v] = c;//頂点vをcで塗る
	for (int i = 0; i < graph[v].size(); i++) {
		if (color[graph[v][i]] == c) {
			return false;
		}
		if (color[graph[v][i]] == 0 && !dfs(graph[v][i], -c)) {
			return false;
		}
	}
	return true;
}
int main(){

	cin >> n >> m;
	graph.resize(n);
	color.resize(n);
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	ll b=0, w=0;
	if (dfs(0, 1)) {
		for (int i = 0; i < n; i++) {
			if (color[i] == 1) {
				b++;
			}
			else if (color[i] == -1) {
				w ++;
			}
		}
		cout << b * w - m << endl;
	}
	else {
		cout << (n*(n - 1) / (ll)2) - m << endl;
	}
	return 0;

}


Measured memory_bytes: 6528
#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;
	}
}
//************************************************************************

void solve()
{
    ll a,b;
    cin >>a >> b;
    int test=0;
    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            if(i+j==a && (i*2+j*4)==b)
            {
                test=1;
                break;
            }
        }

    }
    if(test==1)
    cout << "Yes" << endl;
    else
    cout << "No"  << 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: 3672
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

//wide:幅 tall:高さ no:通れない場所の座標 memo:メモ配列
int wide, tall, num, no[16][16], memo[16][16];

int road(int x, int y)
{

	if(x > wide-1 || y > tall-1 || (no[x][y] == 1) )
	{
		return 0;
	}
	else if(memo[x][y] >= 0)
	{
		return memo[x][y];
	}
	else if(x == wide-1 && y == tall-1)
	{
		return 1;
	}
	else
	{
		return memo[x][y] = road(x+1, y) + road(x, y+1);
	}
}

int main()
{
	while(cin >> wide >> tall)
	{
		if(!wide && !tall)
			break;
		cin >> num;

		memset(memo, -1, sizeof(memo));
		memset(no, 0, sizeof(no));

		int wk, tk;
		for(int i = 0; i < num; i++)
		{
			cin >> wk >> tk;
			no[wk-1][tk-1] = 1;
		}
		cout << road(0, 0) << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (a + b) % 24 << "\n";
    return 0;
}


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

#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
#define mp            make_pair
typedef long long     ll;



int main()
{
map<string,int>ikl;

  ll a,b;
  cin>>a;
  string f;cin>>f;
  char s=f[f.size()-1];
  ikl[f]=1;
  for(int y=1;y<a;y++){
        string h;
    cin>>h;
  if(ikl[h]==1||h[0]!=s){
    cout<<"No";
   return 0;
  }ikl[h]++;
s=h[h.size()-1];
  }
  cout<<"Yes";

   }



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long A = Long.parseLong(sc.next());
		Long B = Long.parseLong(sc.next());
		Long C = Long.parseLong(sc.next());
		Long K = Long.parseLong(sc.next());
		sc.close();
		
		long count = 0;
		if(K - A <= 0) {
			count = count + 1 * K;
		}else {
			count += A;
			if(K - (A + B) <= 0) {
				
			}else {
				long cNum = K - (A + B);
				count -= cNum;
			}
		}
		System.out.println(count);

	}

}

Measured memory_bytes: 35704