akhauriyash/Code-Regression huggingface dataset:
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	k := nextInt()
	s := next()

	n := len(s)
	if n <= k {
		puts(s)
	} else {
		putf("%s...\n", s[:k])
	}
}


Measured memory_bytes: 1764
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int a = sc.nextInt();
			char o = sc.next().charAt(0);
			if (o == '?') {
				break;
			}
			int b = sc.nextInt();
			
			switch (o) {
			case '+':
				System.out.println(a + b);
				break;
			case '-':
				System.out.println(a - b);
				break;
			case '*':
				System.out.println(a * b);
				break;
			case '/':
				System.out.println(a / b);
			}
		}
		sc.close();
	}
}

Measured memory_bytes: 26220
#include<stdio.h>
#include<stdlib.h>
typedef struct Node Node;
struct Node{
    int id;
    int key;
    Node* parent;
    Node* right;
    Node* left;
};
void initialize(Node* n);
int main()
{
    int size;
    scanf("%d",&size);
    int array[size+1];

    for(int i = 1; i<=size; i++)
    {
        scanf("%d", &array[i]);
    }
    Node a[size+1];
    for(int i= 1;i<=size;i++)
    {
        initialize(&a[i]);
    }
    for(int i=1;i<=size;i++)
    {
        a[i].id =i;
        a[i].key = array[i];
        if(2*i<size+1)
           a[i].left = a + 2*i;
        else 
            a[i].left = NULL;
        
        if(2*i+1<size+1)
            a[i].right =a + (2*i)+1;
        else
            a[i].right= NULL;
        
        if(i!=1)
            a[i].parent = a + (i/2);
        else
            a[i].parent= NULL;
    }
    
    for(int i=1;i<=size;i++)
    {
        printf("node %d: ",a[i].id);
        printf("key = %d, ",a[i].key);
        if(a[i].parent!=NULL)
            printf("parent key = %d, ", a[i].parent->key);
        if(a[i].left!= NULL)
            printf("left key = %d, ",a[i].left->key);
        if(a[i].right!= NULL)
            printf("right key = %d, ",a[i].right->key);
        printf("\n");
    }
    
    return 0;
}

void initialize(Node* n)
{
    n->id = 0;
    n->key = 0; 
    n->right = NULL;
    n->left = NULL;
    n->parent = NULL;
}


Measured memory_bytes: 2104
// https://atcoder.jp/contests/abc102/tasks/arc100_a

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 2*1e5;
const int A_I_MAX = 1e9;

int N;
int A[N_MAX];

void solve() {
  REP(i, N) A[i] -= i + 1;
  sort(A, A + N);
  int b = A[N / 2];
  ll ans = 0;
  REP(i, N) ans += abs(A[i] - b);
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%d", A + i);
}

int main() {
  input();
  solve();
  return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

const ll maxn_bellmanford=2505;
vector<vll> G(maxn_bellmanford);
bool reachableFrom1[maxn_bellmanford];
void dfs(ll v){
  if(reachableFrom1[v]) return;
  reachableFrom1[v]=true;
  for(auto nv: G[v]){
    dfs(nv);
  }
}

vector<vll> rG(maxn_bellmanford);
bool reachableToN[maxn_bellmanford];
void rdfs(ll v){
  if(reachableToN[v]) return;
  reachableToN[v]=true;
  for(auto nv: rG[v]){
    rdfs(nv);
  }
}

ll n,m;
vector<tuple<ll,ll,ll>> es;
ll dist[maxn_bellmanford];
bool ok[maxn_bellmanford];

bool bellmanford(ll s){
  fill(dist,dist+n,LINF);
  dist[s]=0;
  bool update=true;
  ll cnt=0;
  while(update){
    update=false;
    for(auto e: es){
      ll a,b,c;
      tie(a,b,c)=e;
      if(!ok[a]||!ok[b]) continue;
      if(chmin(dist[b],dist[a]+c)) update=true;
    }
    if(cnt>=n){
      return true; // has negative loop
    }
    cnt++;
  }
  return false;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>m;
  rep(i,m){
    ll a,b,c; cin>>a>>b>>c; a--,b--; c=-c;
    G[a].push_back(b);
    rG[b].push_back(a);
    es.emplace_back(a,b,c);
  }
  
  dfs(0);
  rdfs(n-1);
  rep(i,n) ok[i]=reachableFrom1[i]&&reachableToN[i];
  
  if(bellmanford(0)){
    cout<<"inf"<<endl;
  }else{
    ll ans=-dist[n-1];
    cout<<ans<<endl;
  }
  
  
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    char str[3]={0};
    scanf("%s", str);
    if(str[0]=='9' || str[1]=='9') {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
  
    return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = ReadInt();
            Console.WriteLine($"{n * 800 - n / 15 * 200}");
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
}


Measured memory_bytes: 11220
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int n = sc.nextInt();
        Map<String, Long> map = new HashMap<>();
        for(int i = 0; i < n; i++) {
            char[] ca = sc.next().toCharArray();
            Arrays.sort(ca);
            String s = String.valueOf(ca);
            if(map.containsKey(s)) map.put(s, map.get(s) + 1);
            else map.put(s, 1L);
        }
        for(String key : map.keySet()) {
            ans += map.get(key) * (map.get(key) - 1) / 2;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 52480
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-6;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll dp[110][110][1010];
int main(){
    int n,s;
    int a[110];
    for(int i=0;i<=100;i++){
        a[i+1]=i;
    }
    while(cin>>n>>s,n+s){
        memset(dp,0,sizeof(dp));
        dp[0][0][0]=1;
        for(int i=1;i<=101;i++){
            for(int j=0;j<=n;j++){
                for(int k=0;k<=s;k++){
                    dp[i][j][k]+=dp[i-1][j][k];
                    if(j>0&&k>=a[i]){
                        dp[i][j][k]+=dp[i-1][j-1][k-a[i]];
                    }
                }
            }
        }
        cout<<dp[101][n][s]<<endl;
    }
}


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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (auto &&i : a) {
        cin >> i;
    }

    auto check = [&](int sign) {
        ll cost = 0; // 必要な操作の回数
        ll sum  = 0; // i番目までの合計
        auto v  = a;
        for (auto &&i : v) {
            sum += i;
            // sumはsignの符号と合わせる
            if (sign * sum < 0) {
                cost += abs(sum) + 1;
                sum += -sum + sign;
            }
            if (sum == 0) {
                cost++;
                sum = sign;
            }
            sign *= -1;
        }
        return cost;
    };

    ll ans = min(check(1), check(-1));
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 998244353;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

ll dp[4010][4010];
string S;

void solve() {
	cin >> S;
	int N = sz(S);
	vi red, blue;
	rep(i, 0, N) {
		if(S[i] == '0') {
			red.pb(i);
			red.pb(i);
		}
		else if(S[i] == '1') {
			blue.pb(i);
			red.pb(i);
		}
		else {
			blue.pb(i);
			blue.pb(i);
		}
	}
	dp[0][0] = 1;
	int R = sz(red), B = sz(blue);
	rep(i, 0, R + 1) {
		rep(j, 0, B + 1) {
			if(i == R && j == B) continue;
			if(i == R) ADD(dp[i][j + 1], dp[i][j]);
			else if(j == B) ADD(dp[i + 1][j], dp[i][j]);
			else {
				if(i + j >= red[i]) ADD(dp[i + 1][j], dp[i][j]);
				if(i + j >= blue[j]) ADD(dp[i][j + 1], dp[i][j]);
			}
		}
	}
	cout << dp[R][B] << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 123520
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<bitset>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define X 4000010
bitset<X> bs=1;
int main(){
	int n,sum=0;
	cin>>n;
	lol(i,n){
		int a;cin>>a;
		sum+=a;
		bs|=bs<<a;
	}
	for(int i=(sum+1)/2;i<=sum;i++){
		if(bs[i]==true){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 1792
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
//<< setprecision(5)
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
const int mod=1000000007;
const int big=1e9+10;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
class seg{public:
	int val;
	int seghi,segmg;
	seg *left,*right;
	seg(int hi,int mg){
		left=nullptr;right=nullptr;val=0;
		seghi=hi;segmg=mg;
		if(hi+1==mg){return;}
		left=new seg(hi,(hi+mg)/2);
		right=new seg((hi+mg)/2,mg);
	}
	int ask(int hi,int mg){
		if(hi<=seghi&&segmg<=mg){return val;}
		if(mg<=seghi||segmg<=hi){return big;}
		return min(left->ask(hi,mg),right->ask(hi,mg));
	}
	void kou(int bas,int num){
		if(seghi==bas&&seghi+1==segmg){val=num;return;}
		if(bas<(seghi+segmg)/2){left->kou(bas,num);}
		else{right->kou(bas,num);}
		val=min(left->val,right->val);
	}
};
int main(void){
	int i,j,n;cin>>n;
	seg A(0,n);
	seg B(0,n);
	vector<int>re;//??´??°?????????????¨??????????????????´??°????????????
	for(i=0;i<n;i++){int a;cin>>a;A.kou(i,a);}
	for(i=0;i<n;i++){int a;cin>>a;B.kou(i,a);}
	for(i=0;i<n;i++){re.pub(i);}
	int q;cin>>q;
	while(q--){
		int x,y,z;cin>>x>>y>>z;
		if(x==1){A.kou(y-1,z);re.pub(y-1);}
		if(x==2){B.kou(y-1,z);re.pub(y-1);}
		if(x==3){cout<<A.ask(y-1,z)<<endl;}
		if(x==4){cout<<B.ask(y-1,z)<<endl;}
		if(x==5){
			for(i=0;i<re.size();i++){
				A.kou(re[i],B.ask(re[i],re[i]+1));
			}
			re.clear();
		}
		if(x==6){
			for(i=0;i<re.size();i++){
				B.kou(re[i],A.ask(re[i],re[i]+1));
			}
			re.clear();
		}
	}
	return 0;
}

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

int main(){
  string s;cin>>s;
  int num=stoi(s);
  int sum=0;
  for(int i=0;i<s.size();i++){
    sum+=int(s.at(i)-'0');
  }
  cout << (num%sum==0? "Yes" : "No") << endl;
}


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

string s;

int main() {
	cin >> s;

	int s1 = stoi(s.substr(0,2));
	int s2 = stoi(s.substr(2,2));

	if (1 <= s1 && s1 <= 12)
	{
		if (1 <= s2 && s2 <= 12)
		{
			cout << "AMBIGUOUS" << endl;
		} else {
			cout << "MMYY" << endl;
		}
	} else {
		if (1 <= s2 && s2 <= 12)
		{
			cout << "YYMM" << endl;
		} else {
			cout << "NA" << endl;
		}
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << v[k - 1] << endl;
}

Measured memory_bytes: 256
from itertools import accumulate

while True:
    N, K = map(int, input().split())
    if N == 0:
        break
    A = [int(input()) for _ in range(N)]

    S = list(accumulate([0] + A))
    ans = max(S[i] - S[i-K] for i in range(K, len(S)))
    print(ans)


Measured memory_bytes: 14352
#include<stdio.h>
#include<string.h>

int main(void)
{
  int c=0;
  char s[4];
  scanf("%s",s);
  if(s[0]=='1')
    c++;
  if(s[1]=='1')
    c++;
  if(s[2]=='1')
    c++;
  printf("%d\n",c);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;

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

  ll r, x, tmp;
  x = a * b;

  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;
  while(r != 0 ) {
    a = b;
    b = r;
    r = a % b;
  }

  cout << x / b << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll roundd(ll x,ll n){
  if(x>n){return x%n;}
  else if(x<0){return x%n+n;}
  else return x;
}
bool isprime(ll n){
    if(n==1)return false;
    for (ll i = 2; i * i <= n; i++) {
        if(n%i==0)return false;
    }
    return true;
}

ll modpow(ll x, ll n){
	ll r=1;
	while(n){
		if(n&1) r=r*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return r;
}
int main(){
  ll a,b,c,k;cin>>a>>b>>c>>k;
  while(b<=a){
    b*=2;k--;
    
  }
  while(c<=b){
    c*=2;k--;
    
  }
  if(k>=0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}



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

int main() {
    int N;
    long Ln = 1, Ln_1 = 1, Ln_2 = 2;
    
    cin >> N;
    
    for (int i = 1; i < N; i++) {
        Ln = Ln_1 + Ln_2;
        Ln_2 = Ln_1;
        Ln_1 = Ln;
    }
    
    cout << Ln << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, M, K; 
  cin >> N >> M >> K;

  vector<int> A(N);
  REP(i, N) cin >> A[i];

  vector<int> B(M+1);
  REP(i, M) cin >> B[i+1];

  REP(i, M) B[i+1] += B[i];

  int ans = upper_bound(ALL(B), K)-B.begin()-1;
  int now = 0;
  REP(i, N){
    now += A[i];
    if(now > K) break;

    chmax(ans, i+1+(upper_bound(ALL(B), K-now)-B.begin())-1);
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 6364
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define ll long long

int main(void){
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;

    if(a1+a2+a3 > 21){
        cout << "bust" << endl;
    }else{
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
typedef long long ll;
using namespace std;

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

const long long INF = 1LL << 60;
string s;
ll res = 0;
int main()
{
	cin >> s;
	int n = s.length();
	for (int bit = 0; bit < (1 << (s.size() - 1)); bit++) {
		ll num = s[0] - '0';
		for (int i = 0; i < s.size() - 1; i++) {
			if (bit & 1 << i) {
				res += num;
				num = 0;
			}
			num = num * 10 + s[i + 1] - '0';
		}
		res += num;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    ll p, q, r, s;
    ll n;
    cin >> p >> q >> r >> s;
    cin >> n;

    ll ans = 0;
    ll mi;
    if (n % 2 == 1) {
        n--;
        mi =  min({p * 4, q * 2, r});
        ans += mi;
    }
    if (n >= 2) {
        mi = min({p * 8, q * 4, r * 2, s});
        ans += (n / 2) * mi;
    }
    cout << ans << '\n';
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<utility>
#include<numeric>
#include<vector>
#include<map>
#include<set>
#include<tuple>
#include<stack>
#include<queue>
#include<functional>
#include<iterator>
#include<cmath>
#include<cctype>

using namespace std;

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

const int INF = 1e9;
const ll LINF = 1e18;

struct edge{int to,cost;};

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

	int h,w,n;
	cin >> h >> w >> n;

	P a_i[n];
	int a;
	for(int i=1;i<=n;i++){
		cin >> a;
		a_i[i-1] = P(a,i);
	}
//	sort(a_i,a_i+n);
	int cont[h*w];
	int num=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<a_i[i].first;j++){
			cont[num++] = a_i[i].second;
		}
	}

	num=0;
	int ans[h][w];
	for(int i=0;i<h;i++){
		if(i%2==0){
			for(int j=0;j<w;j++){
				ans[i][j] = cont[num++];
			}
		}
		else if(i%2==1){
			for(int j=w-1;j>=0;j--){
				ans[i][j] = cont[num++];
			}
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cout << ans[i][j] << (j!=w-1?" ":"\n");
		}
	}

	return 0;
}

Measured memory_bytes: 512
from collections import deque

INF = float("inf")
IINF = 10 ** 18
MOD = 998244353


def main():
    BLACK = '#'
    WHITE = '.'
    H, W, K = map(int, input().split())
    graph = [None] * H
    # w_score = [[0 for i in range(W)] for i in range(H)]
    # h_score = [[0 for i in range(W)] for i in range(H)]
    options = [(0, -1), (0, 1)]
    visited = [[False for i in range(W)] for i in range(H)]
    ans = [[0 for i in range(W)] for i in range(H)]
    idx = 1

    for i in range(H):
        graph[i] = list(input())

    for i in range(H):
        for j in range(W):
            if graph[i][j] == BLACK:
                visited[i][j] = True
                ans[i][j] = idx

                q = deque()
                q.append((i, j))
                while len(q) != 0:
                    p = q.popleft()

                    for d in options:
                        ni = p[0] + d[0]
                        nj = p[1] + d[1]

                        if ni >= 0 and ni < H and nj >= 0 and nj < W and not visited[ni][nj] and graph[ni][nj] == WHITE:
                            visited[ni][nj] = True
                            ans[ni][nj] = idx
                            q.append((ni, nj))
                idx += 1

    for i in range(H):
        for j in range(W):
            if i == 0 and ans[i][j] == 0:
                n = 1
                while ans[i+n][j] == 0:
                    n += 1
                ans[i][j] = ans[i+n][j]
            elif ans[i][j] == 0:
                ans[i][j] = ans[i-1][j]

    for i in range(len(ans)):
        print(*ans[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 53084
#include <iomanip>
#include <iostream>

using namespace std;
// clang-format off
using i64 = int64_t;
using i32 = int32_t;
#define all(x) x.begin(), x.end()
#define int i64
template <class T, typename U> constexpr inline bool exist(const T &s, const U &e) { return s.find(e) != s.end(); }
template <class T> constexpr inline i32 SZ(const T &x) { return x.size(); }
template <class T> constexpr inline bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> constexpr inline bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
const char el = '\n'; const i32 MOD = 1e9 + 7, INF = 0x3f3f3f3f; const i64 INFLL = ((i64)INF << 32) | INF;

#ifdef LOCAL // debugging swiss knife
template <typename Ostream, typename Cont> enable_if_t<is_same<Ostream, ostream>::value, Ostream &> operator<<(Ostream &os, const Cont &v) { os << "{"; for (const auto &x : v) os << x << ", "; return os << "}"; }
template <typename Ostream, typename... Ts> Ostream &operator<<(Ostream &os, const pair<Ts...> &p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class... Args> void dbg_out(Args... args) { ((std::cerr << "\033[32m" << args << "\033[37m, "), ...); }
#define dbg(...) cerr << "\033[1;31m" << __LINE__ << ": [" << #__VA_ARGS__ << "]\033[37m  = ", dbg_out(__VA_ARGS__), cerr << "\033[0m" << endl;
#else
#define dbg(...) ;
#endif
// clang-format on
////////////////////////////////// TEMPLATE ENDS /////////////////////////////////

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(13), cerr << fixed << setprecision(3);

    int n;
    cin >> n;
    int ans = n * (n + 1) / 2;
    for (i64 i = 1; i < n; ++i) {
        ans += i * (i + 1) / 2;
        int l, r;
        cin >> l >> r;
        if (l > r) swap(l, r);
        ans -= l * (n + 1 - r);
    }
    cout << ans << el;

    return 0;
}

#undef int

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  
  if(a<=5) co(0);
  else if(a<=12) co(b/2);
  else co(b);
}


Measured memory_bytes: 256
import itertools
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break
    count = 0
    num = list(range(1, n + 1))
    c = list(itertools.combinations(num, 3))
    for i in range(len(c)):
        if sum(c[i]) == x:
            count += 1
    print(count)



Measured memory_bytes: 31420
N = 100
INF = float('inf')
M = [[INF for _ in range(N)] for _ in range(N)]
n = 0
WHITE = 0
GRAY = 1
BLACK = 2
color = [WHITE for _ in range(N)]
d = [INF for _ in range(N)]
p = [0 for _ in range(N)]


def main():
    global N
    n = int(input())
    for i in range(n):
        a_s = list(map(int, input().split(' ')[1:]))
        for j in range(n):
            if a_s[j] != -1:
                M[i][j] = M[j][i] = a_s[j]
    print(prim(n))


def prim(n):
    d[0] = 0
    p[0] = -1

    while True:
        mincost = INF
        for i in range(n):
            if color[i] != BLACK and d[i] < mincost:
                mincost = d[i]
                u = i

        if mincost == INF:
            break

        color[u] = BLACK

        for v in range(n):
            if color[v] != BLACK and M[u][v] < INF:
                if M[u][v] < d[v]:
                    d[v] = M[u][v]
                    p[v] = u
                    color[v] = GRAY
    return sum(d[:n])


if __name__ == '__main__':
    main()



Measured memory_bytes: 5820
#include<stdio.h>
#include<string.h>


int N;
int SOD[10000000+100]={};
void generateSOD()
{
    for(int i = 1; i <= N; i++)
    {
        for(int j = i; j <= N; j += i)
        {
            SOD[j] += 1;
        }
    }
}



int main()
{
    long long int i,n,m,sum=0;
    scanf("%lld",&N);
    generateSOD();
    for (i=1;i<=N;i++)
    {
        sum=sum+(SOD[i]*i);
    }
    printf("%lld",sum);


}


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

using namespace std ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	long long n ,  k;
	cin>>n>>k ;
	long long ans = 0ll ;
	for(long long i = max(1ll , k) ; i <= n ; ++i)
	{
		ans += (n - i) ;
		for(long long j = i ; j <= n ; j += i)
		{
			long long now = min(n+1 , j+i) ;
			ans += max(0ll , (now - (j + k))) ;
		}
	}
	return cout<<ans<<"\n" , 0 ;
}

Measured memory_bytes: 256
#define __mode_debug__
/*   ξ
     ll
   ＿ll＿
 ／  ∞  ＼
│*  Ａ  *│
│*  Ｃ  *│
│*  祈  *│
│*  願  *│
│*      *│
 ￣￣￣￣￣    */
//C++14 (GCC 5.4.1)
#include <bits/stdc++.h>
using namespace std;
#ifdef __mode_debug__
    #define DBG
#else
    #define DBG if(false)
#endif

#define LLINF (1LL<<60)
using ll = long long;
#define mod  1000000007

#define whole(a) (a).begin(),(a).end()
#define rwhole(a) (a).rbegin(),(a).rend()

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)
#define each(itr,ds) for(auto itr=(ds).begin();itr!=(ds).end();itr++)

template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

//DUMP
//  ostream vector<T> , vector<vector<T>> , set<T> ,queue<T> , priority_queue<T> , pair<T,U> , map<T,U>
template<class T> ostream& operator<<(ostream&os,vector<T>&vec){os<<"{ ";rep(i,vec.size()) os<<((i==0)?"":", ")<<i<<":"<<vec[i];os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,vector<vector<T>>&vec){os<<"{"<<endl;rep(i,vec.size())os<<"\t   "<<i<<":"<<vec[i]<<((i==vec.size()-1)? "":",")<<endl;os<<"\t }";return os;}
template<class T> ostream& operator<<(ostream&os,set<T>&p){os<<"{ ";each(itr,p)  os<<((itr==p.begin())?"":", ")<<*itr;os<<" }";return os;}
template<class T> ostream& operator<<(ostream&os,queue<T>&p){queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.front();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T> ostream& operator<<(ostream&os,priority_queue<T>&p){priority_queue<T> q(p);os<<"[< "<<(q.empty()?" <]":"");while(!q.empty()){os<<q.top();q.pop();os<< (q.empty() ? " <]" : ", ");}return os;}
template<class T,class U> ostream& operator<<(ostream&os,pair<T,U>&p){os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T,class U> ostream& operator<<(ostream&os,map<T,U>&p){os<<"{ ";each(itr,p)os<<((itr==p.begin())?"":", ")<<itr->first<<":"<<itr->second;os<<" }";return os;}
void dump_f(string &nm,char t){cerr<<endl;}
template<class T,class... Ts> void dump_f(string &nm,char t,T &&x,Ts&&... ts){int l=nm.find_first_of(',');string name(nm,0,l),nx(nm,l+1,-1);if(t=='\n') cerr<<"  "<<name<<"\t: "<<x<<t;else cerr << name<<": "<<x<<","<<t;dump_f(nx,t,forward<Ts>(ts)...);}
template<class... Ts> void dump_m(int &&ln,string &&nm,char t,Ts&&... ts){cerr<<"[ln: "<<ln<<"]"<<t;dump_f(nm,t,forward<Ts>(ts)...);}
#define dump(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\n',__VA_ARGS__)
#define dl(...) DBG dump_m(__LINE__,#__VA_ARGS__,'\t',__VA_ARGS__)

#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(whole(V),c))

int main() {
    ios::sync_with_stdio(false);//stdout<=>cout
    cin.tie(nullptr);//cin<=>cout


    ll N,K;
    cin >>N>>K;

    int t=0;
    while(N>0){
        N/=K;
        t++;
    }
    cout << t <<endl;


    return (0);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);



int main(){
	FAST_IO
	
	string s; cin >> s;
	
	auto check = [&](char a, char b, char c){
		int f = s[0] - '0';
		f += (a == '+' ? 1 : -1) * (s[1] - '0');
		f += (b == '+' ? 1 : -1) * (s[2] - '0');
		f += (c == '+' ? 1 : -1) * (s[3] - '0');
		if(f == 7){
			cout << s[0] << a << s[1] << b << s[2] << c << s[3] << "=7\n";
			return true;
		}
		return false;
	};
		
	
	
	for(char f : {'+', '-'}){
		for(char se : {'+', '-'}){
			for(char t : {'+', '-'}){
				if(check(f, se, t)) return 0;
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N =  1e5 + 10;
 
struct IOsetup{
  IOsetup(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cout.tie(nullptr);
   cout << fixed << setprecision(20);
  }
}IO;

int32_t main(){
  int n; cin >> n;
  int a[n + 1], mn, sum;
  mn = INF;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i <= 100; i++){
   sum = 0;
   for (int j = 0; j < n; j++){
     sum += (a[j] - i) * (a[j] - i);
   }
   mn = min(mn, sum);
  }
  cout << mn << endl; 
}

Measured memory_bytes: 256
#input
N, M = map(int, input().split())

jobs = {}
for _ in range(N):
    A, B = map(int, input().split())
    if A > M :
        continue
    if A in jobs:
        jobs[A].append(B)
    else:
        jobs[A] = [B]

#output
import heapq

#点数配列の用意
point = 0
hq = []
#M-i日目(1 <= i <= M)に働ける仕事の中で、Bが最大のものを選ぶ
for A in range(1, M+1):
    if A in jobs:
        for B in jobs[A]:
            heapq.heappush(hq, -B)
    else:
        if len(hq) == 0:
            continue
    point += -heapq.heappop(hq)

print(point)

Measured memory_bytes: 25936
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  cout << d[n / 2] - d[n / 2 - 1] << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
mt19937 rnd(228);
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()
#define pNN pair <Node *, Node *>
#define SZ(x) (int)(x).size()
#define pii pair <int, int>
#define pb push_back
#define rev reverse
#define ins insert
#define ers erase
#define S second
#define F first
#define int ll
const int N = 505, Q = 1030, INF = 1e9 + 10;
 
void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    if (a % 2 == b % 2) {
        cout << (b - a) / 2;
    } else {
        int x = a + (b - a - 1) / 2;
        a = n - a + 1;
        b = n - b + 1;
        int y = a + (b - a - 1) / 2;
        cout << min(x, y);
    }
}
signed main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    #ifdef Solenoid555
        freopen("input.txt", "r", stdin);
    #endif
    solve();
    return 0;
}

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

#include <bits/stdc++.h>
#include <iostream>
#define FASTIO std::ios::sync_with_stdio(false);
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 dp[3002][3002], vis[3002][3002];
string s, t, p, q;
int main() {
  FASTIO
  cin >> s >> t;
  int x, y, val;
  bool flag = false;
  string ans = "";
  for (int i = 0; i <= s.length(); i++) {
    for (int j = 0; j <= t.length(); j++) {
      if(i == 0 || j == 0) {
        dp[i][j] = 0;
        continue;
      }
      if (s[i - 1] == t[j - 1]) {
        dp[i][j] = dp[i - 1][j - 1] + 1;
        vis[i][j] = 1;
      }
      else {
      dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
      }
    }
  }
  x = s.length() + 1, y = t.length() + 1, val = dp[s.length()][t.length()];
  for (int i = s.length(); i > 0; i--){
    for (int j = t.length(); j > 0; j--) {
      if(dp[i][j] == val && i < x && j < y && vis[i][j]){
        ans = s[i - 1] + ans;
        x = i, y = j, val--;
      }
    }
  }
  cout << ans << endl;

}


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

bool chk(string x,string y,int indx)
{
	string t="";
	for(int i=0;i<y.size();i++) t+=x[indx+i];
	
	return t==y;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	string x,y;
	cin>>x>>y;
	x+=x;
	
	bool flag=0;
	
	for(int i=0;i<x.size();i++)
	{
		if(i+y.size()<x.size()) flag|=chk(x,y,i);
	}
	
	if(flag) cout<<"Yes\n";
	else cout<<"No\n";
					                                				
	cerr<<"\nTime elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms\n";
	
	return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: [usize; 6] = [0, 0, 0, 3, 2, 1];
    println!("{}", c[a + b]);
}

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

ll cmb(ll n) {
  if(n < 0)
    return 0;
  else
    return n * (n - 1) / 2;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
    a[i]--;
  }

  map<int, int> cnt;
  rep(i, n) cnt[a[i]]++;

  map<int, ll> ans;
  rep(i, cnt.size()) {
    int q = cnt[i];
    if(q == 0)
      continue;
    ll aa = cmb(q - 1);
    if(ans[q] == 0) {
      rep(j, cnt.size()) {
        if(j == i)
          continue;
        aa += cmb(cnt[j]);
      }
      ans[q] = aa;
    }
  }

  rep(i, n) cout << ans[cnt[a[i]]] << endl;
}


Measured memory_bytes: 13520
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> country(N);
  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    
    country.at(a - 1)++;
    country.at(b - 1)++;
  }
  
  for (int i = 0; i < N; i++) {
    cout << country.at(i) << endl; 
  }
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
class Main{
 public static void main(String args[]){
   Scanner sc = new Scanner(System.in);
   int n= sc.nextInt();
   Set<String> s = new HashSet<String>();
   
   for(int i=0;i<n;i++) {
	   s.add(sc.next());
   }
   System.out.println(s.size());
 }
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

ll dp[100005];

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll N;
  scanf("%lld", &N);

  vector<ll> h_list(N);
  for (ll i = 0; i < N; i++) {
    ll v;
    scanf("%lld", &v);
    h_list[i] = v;
  }

  for (ll i = 1; i < 100005; i++) {
    dp[i] = 9999999999LL;
  }

  for (ll i = 0; i < N; i++) {
    if (i + 1 < N) {
      ll plus1 = abs(h_list[i] - h_list[i + 1]);
      dp[i + 1] = min(dp[i + 1], dp[i] + plus1);
    }

    if (i + 2 < N) {
      ll plus2 = abs(h_list[i] - h_list[i + 2]);
      dp[i + 2] = min(dp[i + 2], dp[i] + plus2);
    }
  }

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


Measured memory_bytes: 1792
# -*- config: utf-8 -*-
if __name__ == '__main__':
	for i in range(int(raw_input())):
		nums = map(lambda x:x**2,map(int,raw_input().split()))
		nums.sort()
		if nums[0]+nums[1] == nums[2]:
			print "YES"
		else :
			print "NO"

Measured memory_bytes: 4212
s1 = input()
n1 = int(s1)
n2 = int(s1[0])

r1 = 0

if n1 <= ((n2 * 100) + (n2 * 10) + n2):
    r1 = (n2 * 100) + (n2 * 10) + n2
else:
    r1 = ((n2 + 1) * 100) + ((n2 + 1) * 10) + n2 + 1

print(r1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	vector<string> ans(h,"");
	for (int i = 0; i < h;i++){
		for (int j = 0; j < w;j++){
			if((i< b) xor (j<a) ){
				ans[i] += '0';
			}else{
				ans[i] += '1';
			}
		} }
	rep(i, h) { cout << ans[i]<<endl; }
	//cout << ans << endl;
}

/*
3 5 2 1
AABBB => 0:1
CCDDD => 1:0
CCDDD  =>1:0
*/

Measured memory_bytes: 5492
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int x;
    int y;
    scanf("%d",&x);

    y=x%10;
    
    switch (y)
    {
    case 0:
    printf("pon");
    break;
    
    case 1:
    printf("pon");
    break;

    case 2:
    printf("hon");
    break;

    case 3:
    printf("bon");
    break;

    case 4:
    printf("hon");
    break;

    case 5:
    printf("hon");
    break;

    case 6:
    printf("pon");
    break;

    case 7:
    printf("hon");
    break;

    case 8:
    printf("pon");
    break;

    case 9:
    printf("hon");
    break;
    }
}

Measured memory_bytes: 1732
#include <iostream>

using namespace std;

int main()
{
    int D, N;
    cin >> D >> N;

    if (N == 100)
        ++N;
        
    if (D == 0)
        cout << N << '\n';
    else if (D == 1)
        cout << N << "00\n";
    else
        cout << N * 10000 << '\n';

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  vector<int> pos(24);
  pos[0]++;
  
  map<int, int> mp;
  rep(i, n){ 
    int d;
    cin >> d;
    if(d>=13) d = 24-d;
    mp[d]++;
  }
  
  bool ok = true;
  
  int lr=0;
  for(auto p : mp){
    if(p.second >= 3) ok = false;
    if(p.first == 0) ok = false;
    if(p.first == 12 && p.second >=2) ok = false;
    
    if(p.second == 1){
      if(lr == 0){
        pos[p.first]++;
        lr = 1;
      }else{
        pos[24-p.first]++;
        lr = 0;
      }
    }
    if(p.second == 2){
      pos[p.first]++;
      pos[24-p.first]++;
    }
  }
  
  int ans = 13;
  rep(i, 24){
    rep(j, 24){
      if(i == j) continue;
      if(pos[i] && pos[j]){
        int gap = abs(i-j);
        chmin(ans ,min(gap,24-gap));
      }
    }
  }
  
  if(ok) cout << ans << endl;
  else cout << 0 << endl;
    
  return 0;     
}


Measured memory_bytes: 256