akhauriyash/Code-Regression huggingface dataset:
#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++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int s; cin >> s;
    vector<int> a;
    a.push_back(s);
    int count = 1;

    if(s==1){
        cout << 4 << endl;
        return 0;
    }else if(s==2){
        cout << 4 << endl;
        return 0;
    }
    while(1){
        if(s==4){
            cout << count+3 << endl;
            return 0;
        }
        if(s%2==0){
            s = s/2;
        }else{
            s = 3*s+1;
        }
        count ++;
    }
    return 0;
}

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

int main(){
    float N,a,b,c;
    cin >> N;
    vector<float> abc(N);
    priority_queue< float, vector<float>, greater<float> > que;
    rep(i,N) cin >> abc[i];
    rep(i,N) que.push(abc[i]);
    repr(i,0,N-1){
        a=que.top();que.pop();
        b=que.top();que.pop();
        que.push((a+b)/2);
    }
    cout << que.top() << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <math.h>


int main()
{
	int n;
	std::cin >> n;
	while (n != 0) {
		int* dataset = new int[n];
		int data, sum = 0;
		for (int i = 0; i < n; i++) {
			std::cin >> data;
			dataset[i] = data;
			sum += data;
		}
		double avg, sd = 0;
		avg = static_cast<double>(sum) / n;
		for (int i = 0; i < n; i++) {
			sd += pow((static_cast<double>(dataset[i]) - avg), 2);
		}
		sd = sqrt(sd / n);
		std::cout << std::setprecision(5) << std::fixed << sd << "\n";
		delete[] dataset;
		dataset = 0;
		std::cin >> n;
	}
    return 0;
}




Measured memory_bytes: 3304
from typing import List


def is_able_to_load(tmp_P: int, weights: List[int], track_num_max: int) -> bool:
    track_num = 1
    tmp_sum = 0
    for w in weights:
        if tmp_sum + w <= tmp_P:
            tmp_sum += w
        else:
            track_num += 1
            tmp_sum = w
            if track_num > track_num_max:
                return False
    return True


if __name__ == "__main__":
    n, k = map(lambda x: int(x), input().split())
    weights = list(map(lambda x: int(input()), range(n)))

    left_weight = max(weights)
    right_weight = 10000 * 100000
    mid_weight = (left_weight + right_weight) // 2
    optimal_P = right_weight

    while left_weight <= right_weight:
        if is_able_to_load(mid_weight, weights, k):
            optimal_P = mid_weight
            right_weight = mid_weight - 1
        else:
            left_weight = mid_weight + 1

        mid_weight = (left_weight + right_weight) // 2

    print(f"{optimal_P}")



Measured memory_bytes: 11096
(defun solver ()
  (let* ((n (read)) (an (make-array n :fill-pointer 0)))
    (loop repeat n do
          (vector-push (read) an))
    (sort an #'>)
    (format t "~a~%" (sub an n))))

(defun sub (ar n)
  (let ((p 0) (m 0))
    (loop for i from 0 to (1- n) do
          (if (evenp i)
              (incf p (aref ar i))
              (decf m (aref ar i))))
    (+ p m)))

(solver)

Measured memory_bytes: 8032
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;
  	cin>>n;
  	int ans=0;
  	for(int i=1;i<=n;i+=2){
    	int cnt=0;
      	range(j,1,n+1)if(i%j==0)cnt++;
      	if(cnt==8)ans++;
    }
  	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  char b;
  char a[4]="ATGC";
  int i;
  scanf("%c",&b);
 for(i=0;i<=3;i++){
   if(a[i]==b)
     break;}
  if(i%2==0)
    i++;
  else i--;
  printf("%c",a[i]);
  return 0;
}

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

int main() {
  int N;
  int ac_count = 0;
  int wa_count = 0;
  int tle_count = 0;
  int re_count = 0;
  scanf("%d", &N);
  char str[N];
  for (int i = 0; i < N; i++) {
    scanf("%s", &str[i]);
  }
  for (int j = 0; j < N; j++) {
    if (strncmp(&str[j], "AC", 1) == 0) {
      ac_count++;
    } else if (strncmp(&str[j], "WA", 1) == 0) {
      wa_count++;
    } else if (strncmp(&str[j], "TLE", 1) == 0) {
      tle_count++;
    } else {
      re_count++;
    }
  }

  printf("AC x %d\n", ac_count);
  printf("WA x %d\n", wa_count);
  printf("TLE x %d\n", tle_count);
  printf("RE x %d\n", re_count);
  return 0;
}

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

int a[59], b[59], n;

int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
        b[i] = a[i];
    }
    int ans = 0;
    sort(a + 1, a + n + 1);
    for(int i = 1; i <= n; i++){
        if(a[i] != b[i]){
            ans++;
        }
    }
    if(ans <= 2) printf("YES\n");
    else printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
r,g,b,n=map(int,input().split())
boxSize=[r,g,b]
boxSize.sort(key=lambda x:-x)
# print(boxSize)
maxCnt=[n//boxSize[i]+1 for i in range(3)]
# print(maxCnt)
ans=0
if boxSize[1]==1:
    for cnt0 in range(maxCnt[0]):
        ans+=n-cnt0*boxSize[0]+1
else:
    for cnt0 in range(maxCnt[0]):
        for cnt1 in range(maxCnt[1]):
            reg=n-cnt0*boxSize[0]-cnt1*boxSize[1]
            if reg<0:
                break
            if reg%boxSize[2]==0:
                ans+=1
print(ans)


Measured memory_bytes: 3064
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    
    const N    = ~~arg[0].split(" ")[0];
    const v    = arg[1].split(" ").map(n=>~~n);
    
    let even = [];
    let odd  = [];
    
    for(let i=0; i<N; i++) {
        const h = v[i];
        let a = (i % 2 ? odd : even)[h];
        
        a = a || {val:h, count: 0};
        a.count++;
        
        if(i % 2) {
            odd[h] = a;
        } else {
            even[h] = a;
        }
    }
    
    even = even.sort((a,b)=>a.count-b.count).reverse().filter(a=>a);
    odd  = odd.sort((a,b)=>a.count-b.count).reverse().filter(a=>a);
  
    if(even[0].val!=odd[0].val){
        console.log(N - even[0].count - odd[0].count);
        return;
    }
    
    // 全て同じ値のとき
    if(!even[1] && !even[2]){
        console.log(N/2);
        return;
    }
    
    // 偶数番目のみ全て同じ値のとき
    if(!even[1]){
        console.log(N - even[0].count - odd[1].count);
        return;
    }
    
    // 奇数番目のみ全て同じ値のとき
    if(!odd[1]){
        console.log(N - even[1].count - odd[0].count);
        return;
    }
    
    console.log(Math.min(
        N - even[0].count - odd[1].count,
        N - even[1].count - odd[0].count
    ));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 45936
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();

		long x[] = new long[N];
		long y[] = new long[N];
		long z[] = new long[N];

		for(int n=0;n<N;n++){
			x[n] = sc.nextLong();
			y[n] = sc.nextLong();
			z[n] = sc.nextLong();
		}

		long max = 0;
		long v[] = new long[N];

		for(int a=0;a<2;a++){
			for(int b=0;b<2;b++){
				for(int c=0;c<2;c++){

					for(int n=0;n<N;n++){
						v[n] = (long)Math.pow((-1),a)*x[n] + (long)Math.pow((-1),b)*y[n] + (long)Math.pow((-1),c)*z[n];
					}

					Arrays.sort(v);
					long val = 0;
					for(int m=0;m<M;m++){
						val += v[N-m-1];
					}
					if(max < val){
						max = val;	
					} 

				}
			}			
		}
		

		System.out.println(max);

	}
}

Measured memory_bytes: 26968
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let  s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, a: [i32; n]
    }
    let mut a = a;
    a.sort_by(|a, b| b.cmp(a));
    let mut alice = 0;
    let mut bob = 0;

    for (i, card) in a.into_iter().enumerate() {
        if i % 2 == 0 {
            alice += card;
        } else {
            bob += card;
        }
    }

    println!("{}", alice - bob);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

int main() {

	int n, m, c[3000];
	int i, j, l;
	int dp[60000], cnt = 0;

	cin >> n >> m;

	for (i = 0; i < m; i++) cin >> c[i];

	memset(dp, 0x7f, sizeof dp);
	dp[0] = 0;

	for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {


			dp[i+c[j]] = min(dp[i] + 1,dp[i+c[j]]);

		}
	}

	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 3340
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
//
struct pair_match{
	//
	int v;
	vector<int> G[100000];
	vector<int> match,used;
	//
	pair_match(int n){
		v=n;
		match.resize(v);
		used.resize(v);
	}
	//
	void add_edge(int from,int to){
		G[from].push_back(to);
		G[to].push_back(from);
	}
	//
	bool DFS(int v){
		used[v]=true;
		for(int i=0;i<G[v].size();i++){
			int u=G[v][i],w=match[u];
			if(w<0||!used[w]&&DFS(w)){
				match[v]=u;
				match[u]=v;
				return true;
			}
		}
		return false;
	}
	//
	int matching(){
		int res=0;
		fill(match.begin(),match.end(),-1);
		for(int i=0;i<v;i++){
			if(match[i]<0){
				fill(used.begin(),used.end(),0);
				if(DFS(i)){
					res++;
				}
			}
		}
		return res;
	}
};
//
int main(){
	int X,Y,E;
	cin>>X>>Y>>E;
	pair_match PM(X+Y);
	for(int i=0;i<E;i++){
		int x,y;
		cin>>x>>y;
		PM.add_edge(x,X+y);
	}
	cout<<PM.matching()<<endl;
	return 0;

}


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

class Program {
    static void Main (string[] args) {
        var input = INP();
        for(int i = 0;i < 5;i++) {
            if(TOI(input[i]) == 0) {
                CWL(i + 1);
            }
        }
    }

    static string[] INP () {
        return Console.ReadLine().Split(' ');
    }

    static void CWL (string value) {
        Console.WriteLine(value);
    }

    static void CWL (int value) {
        Console.WriteLine(value);
    }

    static void CWL (long value) {
        Console.WriteLine(value);
    }

    static void CWL (float value) {
        Console.WriteLine(value);
    }

    static void CWL (double value) {
        Console.WriteLine(value);
    }

    static int TOI (string str) {
        return int.Parse(str);
    }

    static long TOL (string str) {
        return long.Parse(str);
    }

    static float TOF (string str) {
        return float.Parse(str);
    }

    static double TOD (string str) {
        return double.Parse(str);
    }

    /*static void Main (string[] args) {
        var input = INP();
        var input2 = INP();
        var input3 = INP();

        CWL("dummy");
    }*/
}


Measured memory_bytes: 27472
from collections import deque

queue = deque([])

n, q = map(int, input().split(" "))

for i in range(n):
    name, time = input().split(" ")
    time = int(time)
    queue.append([name, time])

timestamp = 0
while len(queue) > 0:
    h = queue.popleft()
    if h[1] <= q:
        print(h[0], timestamp+h[1])
        timestamp += h[1]
    else:
        h[1] -= q
        queue.append(h)
        timestamp += q
    

Measured memory_bytes: 16108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

int main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;
	ll a[n + 1], b[m + 1], dp[n + 1][m + 1];
	vector <ll> cur(100001);
	
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= m; i++) cin >> b[i];
	
	for (int i = 0; i <= m; i++) dp[0][i] = 1;
	for (int i = 1; i <= n; i++)
	{
		dp[i][0] = 1;
		cur.assign(100001, 0);
		for (int j = 1; j <= m; j++)
		{
			cur[b[j]] = (cur[b[j]] + dp[i - 1][j - 1]) % mod;
			dp[i][j] = (dp[i - 1][j] + cur[a[i]]) % mod;
		}
	}
	cout << dp[n][m];
}

Measured memory_bytes: 32384
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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 int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
	bool operator==(const mint a){
		return x == a.x;
	}
};

istream& operator>>(istream& is, const mint& a){return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a){return os << a.x;}

// 2^n
mint f(int n){
	if(n == 0) return 1;
	mint x = f(n/2);
	x *= x;
	if(n%2 == 1) x *= 2;
	return x;
}

// nCa
mint choose(int n, int a){
	mint x = 1, y = 1;
	rep(i,a){
		x *= n-i;
		y *= i+1;
	}
	return x / y;
}

struct Combination{
	vector<mint> fact, ifact;
	Combination(int n):fact(n+1),ifact(n+1){
		assert(n < mod);
		fact[0] = 1;
		for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k){
		if(n < 0 || k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    Combination comb(n+1);
    mint ans = 0;
    rep(i,n){
        ans += comb(i,k-1) * a[i];
        ans -= comb(n-i-1,k-1) * a[i];
    }
    cout << ans.x << endl;
    return 0;
}


Measured memory_bytes: 5560
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)

N = int(input())
A = [int(input())-1 for i in range(N-1)]
wins = [[] for _ in range(N)]
for i,a in enumerate(A):
    wins[a].append(i+1)

def depth(v):
    if len(wins[v])==0: return 0
    res = []
    for u in wins[v]:
        res.append(depth(u))
    res.sort()
    ret = 0
    for r in res:
        ret = max(r+1,ret+1)
    return ret

print(depth(0))

Measured memory_bytes: 121392
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 998244353

using namespace std;
using ll = long long;
using ldb = long double;

int main() {
    int n; cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++)
        cin >> s[i];
    vector<vector<int>> alp(n, vector<int>(26));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < s[i].size(); j++)
            alp[i][s[i][j] - 'a']++;
    }

    for (int i = 0; i < 26; i++) {
        int cnt = 1e5;
        for (int j = 0; j < n; j++) {
            cnt = min(cnt, alp[j][i]);
        }
        for (int k = 0; k < cnt; k++)
            //cout << i + 'a';
            printf("%c", i + 'a');
    }
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define __STDC_LIMIT_MACROS
#include <stdint.h>
using namespace std;
#define int long long
#define endl '\n'	 
#define pb	push_back
#define setbits(x)		__builtin_popcountll(x)
#define zrobits(x)		__builtin_ctzll(x)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
void c_p_c()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int maxSubArraySum(int a[], int size) 
{ 
    int max_so_far = INT_MIN, max_ending_here = 0, 
       start =0, end = 0, s=0; 
  
    for (int i=0; i< size; i++ ) 
    { 
        max_ending_here += a[i]; 
  
        if (max_so_far < max_ending_here) 
        { 
            max_so_far = max_ending_here; 
            start = s; 
            end = i; 
        } 
  
        if (max_ending_here < 0) 
        { 
            max_ending_here = 0; 
            s = i + 1; 
        } 
    } 
    return 1;
} 
int isPrime(int n)
{
	int a = 0;
	for(int i = 2; i*i<=n; i++)
	{
		if(n%i==0)
			return 0;
	}
	return 1;
}
int bigpower(int a,int b)
{
    int res = 1;
    while(b>0)
    {
        if(b&1)
        {
            res*=a;
        }
        a*=a;
        b>>=1;
    }
    return res;
}
int fact(int n)
{
    int a = 1;
    for(int i = 1; i<=n; i++)
    {
        a*=i;
    }
    return a;
}
struct cmp{
    bool operator() (const pair<int,int> &a, const pair<int,int> &b) const {
        int la = a.second-a.first+1;
        int lb = b.second-b.first+1;
        if(la==lb) return a.first<b.first;
        return la>lb;
    }
};

bool how(pair<int,int> a, pair<int,int> b)
{
    return a.first>b.first;
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	c_p_c();
    int d,t,s;
    cin>>d>>t>>s;
    if(d<=s*t)
        yes;
    else
        no;
}	


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
int main(void)
{
    int N;
    cin >> N;
    vector<int> L(N);
    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }
    SORT(L);
    int ans = 0;
    REP(i, N){
        Rep(j, i+1, N){
            Rep(k, j+1, N){
                if(L[i]<L[j]+L[k] && L[j]<L[i]+L[k] && L[k]<L[i]+L[j]) ans++;
                else break;
            }
            
        }
    }
    pr(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>

using namespace std;

#define l first
#define r second
#define int long long

int n;
int a[500000];
int kek = 1, ans = 0;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (kek == 1)
        {
            ans += a[i] - 1;
            kek = 2;
            continue;
        }
        if (a[i] % kek == 0)
        {
            if (a[i] != kek)
            {
                a[i] -= kek + 1;
                ans++;
            }
            else
            {
                kek = a[i] + 1;
            }
        }
        if (a[i] % kek != 0)
        {
            int nw = a[i] % kek;
            ans += (a[i] - nw) / kek;
        }
    }
    cout << ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x[6];
    for(int i=1;i<=5;i++)
        cin>>x[i];
    for(int i=1;i<=5;i++)
    {
        if(x[i]==0)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


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

const int N = 1e6 + 9;

int n, m, ans, M[N], d[N];
vector<int>v[N];
#define L (x<<1)
#define R (x<<1|1)
int Qry (int x, int l, int r, int ql, int qr) {
	if (l == ql && r == qr) return M[x];
	int mid = (l + r) >> 1;
	if (qr <= mid) return Qry(L, l, mid, ql, qr) + d[x];
	if (ql > mid) return Qry(R, mid + 1, r, ql, qr) + d[x];
	return max(Qry(L, l, mid, ql, mid), Qry(R, mid + 1, r, mid + 1, qr)) + d[x];
}

void Moy (int x, int l, int r, int ql, int qr, int t) {
	if (l == ql && r == qr) return (void)(M[x] += t, d[x] += t);
	int mid = (l + r) >> 1;
	if (qr <= mid) Moy(L, l, mid, ql, qr, t);
	else if (ql > mid) Moy(R, mid + 1, r, ql, qr, t);
	else Moy(L, l, mid, ql, mid, t), Moy(R, mid + 1, r, mid + 1, qr, t);
	M[x] = max(M[L], M[R]) + d[x];
}

int main () {
	scanf("%d%d", &n, &m); ans = max(n - m, 0); ++m;
	for (int i = 1, l, r; i <= n; ++i) scanf("%d%d", &l, &r), v[l].push_back(r);
	for (int i = 0; i <= m; ++i) Moy(1, 0, m, i, i, i - m);
	for (int i = 0; i < m; ++i) {
		for (auto v : ::v[i])
		Moy(1, 0, m, 0, v, 1);
		ans = max(ans, Qry(1, 0, m, i + 1, m) - i);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 34560
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break

    for i in range(H):
        for j in range(W):
            if i == 0 or i == H-1 or j == 0 or j == W-1:
                print("#", end="")
            else:
                print(".", end="")
        print()

    print()



Measured memory_bytes: 7000
#include <stdio.h>
void ABC42(void);
void ABC43(void);
void ABC44(void);
void ABC45(void);
void ABC46(void);

int main(void){
    ABC46();
    return 0;
}

void ABC42(void){
    int a,b,c,n=0;
    scanf("%d %d %d",&a,&b,&c);
    if(a==7||b==7||c==7){
        if((a==5&&b==5)||(b==5&&c==5)||(c==5&&a==5)){
            printf("YES");
            n++;
    }}
    if(n==0)printf("NO");
}

void ABC43(void){
    int i,n,sum=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        sum+=i;
    }
    printf("%d",sum);
}

void ABC44(void){
    int n,k,x,y,i,sum=0;
    scanf("%d",&n);
    scanf("%d",&k);
    scanf("%d",&x);
    scanf("%d",&y);
    if(n>k){
        for(i=1;i<=k;i++)sum+=x;
        for(i=k+1;i<=n;i++)sum+=y;
    }else{
        for(i=1;i<=n;i++)sum+=x;
    }
    printf("%d",sum);
}

void ABC45(void){
    int a,b,h;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&h);
    printf("%d",(a+b)*h/2);
}

void ABC46(void){
    int a,b,c,n;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b||b==c||c==a){
        n=2;
        if(a==b&&a==c)n=1;
    }else{
        n=3;
    }
    printf("%d",n);
}

Measured memory_bytes: 128
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

void solve(ref int[][] g, bool[int[]] obs, int x, int y, int t, int tmax) {
	if(t > tmax) return;

	if(([x,y] in obs) is null){
		//writeln(x, " ", y, " ", t);
		if(g[x][y] > t) {
			g[x][y] = t;
			int[][] dx = [[0, 1], [0, -1], [1, 0], [1, 1], [-1, -1], [-1, 0]];
			foreach(dxi; dx) {
				solve(g, obs, x+dxi[0], y+dxi[1], t+1, tmax);
			}
		}
	}
}

void main(){
	while(true) {
		auto tn = readInts();
		auto t = tn[0];
		auto n = tn[1];
		if((t|n) == 0) return;

		auto offset = [100, 100];
		bool[int[]] obs;
		for(int i; i < n; ++i) {
			int[] xy = readInts();
			xy[] += offset[];
			obs[xy.idup] = true;
		}
		int[] s = readInts();
		s[] += offset[];

		auto g = new int[][](200,200);
		for(int i; i < 200; ++i) {
			for(int j; j < 200; ++j) {
				g[i][j] = int.max/2;
			}
		}
		solve(g, obs, s[0], s[1], 0, t);
		int ans;
		foreach(gi; g) {
			foreach(gii; gi) {
				if(gii <= t) {
					++ans;
				}
			}
		}
		writeln(ans);
	}
}

Measured memory_bytes: 10808
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            if(i * j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <map>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};

namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}
P unit(const P &p){
    return p/abs(p);
}

int main(){
    int n,k;
    cin >> n >> k;
    k--;
    VP p(n);
    for(int i=0; i<n; i++){
        int x,y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    bool over = false;
    for(int i=0; i<n-k and !over; i++){
        map<P, int> dirs;
        for(int j=i+1; j<n; j++){
            P dir = p[i] -p[j];
            if(dir.X < 0 or (dir.X == 0 and dir.Y < 0)) dir = -dir;
            dir = unit(dir);
            dirs[dir]++;
        }
        for(auto e: dirs){
            if(e.second >= k){
                over = true;
                break;
            }
        }
    }
    cout << over << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;

int main() {
	int a, b;
	cin>>a;
	for (int i = 1;i < 10;++i) {
		if (a%i == 0 && a/i < 10) { cout<<"Yes"<<endl; return 0;}
	}
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
def main():
    N, D = map(int, input().split())
    count = 0
    for i in range(N):
        X, Y = map(int, input().split())
        if (X ** 2 + Y ** 2) <= D ** 2:
            count += 1
    print(count)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1);
const ll mod=1e9+7;
int main()
{
	int a,b,c,d;
	cin>>b>>a>>d>>c;
	int flag=1;
	while(b>0&&d>0)
	{
		if(flag)
		{
			d-=a;
			flag=0;
		}
		else
		{
			b-=c;
			flag=1;
		}
	}
	//cout<<b<<endl; 
	if(b<=0)
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3588
#include <iostream>

using namespace std;
typedef long long ll;

ll a, b;

void solve() {
  ll ans = 0;
  a--;
  for (ll i=0;(1LL<<i)<=b;i++) {
    // 2^(i+1) should hold 2^i 0s and 2^i 1s at ith digit.
    // for the remaining part, first base / 2 - 1 are 0s
    ll base = 1LL << (i + 1);
    ll cntB = (b / base) * (base / 2) + max(b % base - base / 2 + 1, 0LL);
    ll cntA = (a / base) * (base / 2) + max(a % base - base / 2 + 1, 0LL);
    if ((cntB - cntA) & 1) {
      ans += (1LL << i);
    }
  }
  cout << ans << endl;
}

int main() {
  cin >> a >> b;
  solve();
}


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

#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define present(t, x) (t.find(x) != t.end())
#define sz(a) int((a).size())
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;

const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int t,d,s;

void solve(){
	cin>>d>>t>>s;
	if(d<=t*s)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}
int main(){
	solve();
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
 
using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
 
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRT(v) sort(v.begin(),v.end())
#define MOD 1000000007
 
typedef long long ll;
typedef tuple<int,int,bool> Tb;


int abc104_c(){
    //入力
    int a;
	cin >> a;
  
    //処理
  
    //出力
    if(a/10==9 || a%10==9) cout << "Yes" << ENT;
  	else cout << "No" << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX + 1];  // Hは最大のノード，Aはヒープの配列

void maxHeapify(int i)
{
    int l, r, largest;
    l = 2 * i;  // 左の子
    r = 2 * i + 1; // 右の子

    // 左の子，自分，右の子で値が最大のノードを選ぶ
    if (l <= H && A[l] > A[i] ) {
        largest = l;
    } else {
        largest = i;
    }
    if (r <= H && A[r] > A[largest] ){
        largest = r;
    }

    if (largest != i) {
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int extract()
{
    int maxv;
    if (H < 1) {
        return -INFTY;
    }
    maxv = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    return maxv;
}

void increaseKey(int i, int key)
{
    if (key < A[i]) {
        return;
    }
    A[i] = key;
    while(i > 1 && A[i / 2] < A[i]) {
        swap(A[i], A[i / 2]);
        i = i / 2;
    }
}

void insert(int key)
{
    H++;
    A[H] = -INFTY;
    increaseKey(H, key);
}

int main()
{
    int key;
    char com[10];

    while(1) {
        scanf("%s", com);
        if (com[0] == 'e' && com[1] == 'n') {
            break;
        }
        if (com[0] == 'i') {
            scanf("%d", &key);
            insert(key);
        } else {
            printf("%d\n", extract());
        }
    }

    return 0;
}


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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var Instance = new Question();
			Instance.Exec();
		}
	}

	public class Question
	{
		public void Exec()
		{
			string dirs = Console.ReadLine();
			bool isConnected = false;

			int ncount = 0;
			int scount = 0;
			int wcount = 0;
			int ecount = 0;
			for (int i = 0; i < dirs.Length; ++i) {
				switch (dirs[i]) {
					case 'N':
					default:
						++ncount;
						break;
					case 'W':
						++wcount;
						break;
					case 'S':
						++scount;
						break;
					case 'E':
						++ecount;
						break;
				}
			}

			if ((scount > 0 && ncount > 0 && ecount > 0 && wcount > 0)
				|| (scount == 0 && ncount == 0 && ecount > 0 && wcount > 0)
				|| (scount > 0 && ncount > 0 && ecount == 0 && wcount == 0)) {
				isConnected = true;
			}

			string str = isConnected ? "Yes" : "No";
			Console.WriteLine($"{str}");
			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 13140
package main

import (
	"fmt"
)

func main() {
	var n, m, c int
	fmt.Scan(&n, &m, &c)

	b := make([]int, m)
	for i := range b {
		fmt.Scan(&b[i])
	}

	count := 0
	for i := 0; i < n; i++ {
		list := make([]int, m)
		for i := range list {
			fmt.Scan(&list[i])
		}
		ans := 0
		for i := 0; i < m; i++ {
			ans += b[i] * list[i]
		}
		if ans+c > 0 {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import sys
def input():
    return sys.stdin.readline()[:-1]
n,m,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.sort()
y.sort()
if x[-1]<y[0] and x[-1]<Y and X<y[0]:
    print("No War")
else:
    print("War")

Measured memory_bytes: 38256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include<queue>

using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n; ++i)
#define ALL(a) (a).begin(),(a).end()
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)

#define INF 1000000000
vector<int> dx  = {0, 0, -1, +1};  
vector<int> dy = {-1, +1, 0, 0}; 

int main(){
    int h, w;
    cin >> h >> w;
    char s[h+1][w+1];

    int wc = -1;
    for(int i = 1; i <= h; ++i)for(int j = 1; j <= w; ++j){
        cin >> s[i][j];
        if(s[i][j] == '.')wc++;
    }

    int route[h+1][w+1];
    queue<pair<int, int>> que;
    for(int i = 1; i <= h; ++i)for(int j = 1; j <= w; ++j)route[i][j] = INF;
    que.push(make_pair(1, 1));
    route[1][1] = 0;
    while(!que.empty()){
        int x = que.front().first;
        int y = que.front().second;
        que.pop();
        if(x == h && y == w)break;
        rep(i, 4){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(nx >=1 && nx <= h && ny >=1 && ny <= w && s[nx][ny] == '.' && route[nx][ny] == INF){
                que.push(make_pair(nx, ny));
                route[nx][ny] = route[x][y] + 1;
            }
        }
    }
    cout << max(wc - route[h][w], -1);
} 

Measured memory_bytes: 256
# from math import factorial

def main():
    x, y = map(int, input().split())
    # m = (i+2, j+1)
    # n = (i+1, j+2)
    # x = 2m + n
    # y = m + 2n
    # 2x - y = 3m
    # 2y - x = 3n

    m = (2*x-y) // 3
    n = (2*y-x) // 3
    def cmb(n, r, mod):
        if (r<0 or r>n):
            return 0
        r = min(r, n-r)
        return fac[n] * finv[r] * finv[n-r] % mod

    mod = 10**9+7 #素数制限
    N = m+n
    fac = [1, 1] # 元テーブル
    finv = [1, 1] # 逆元テーブル
    finv_cal = [0, 1] #逆元計算用

    for i in range(2, N + 1):
        fac.append((fac[-1] * i) % mod)
        finv_cal.append((-finv_cal[mod % i] * (mod//i)) % mod)
        finv.append((finv[-1] * finv_cal[-1]) % mod)
    
    # 行き先のx+yが3の倍数でないとたどり着けない。
    if (x+y) % 3 != 0:
        print(0)
    else:
        # m, n どちらかが負かもしくはどちらも0の時
        if m < 0 or n < 0 or (m+n) == 0:
            print(0)
        else:
            ans = cmb(m+n, n, mod)           
            print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 88488
#include <bits/stdc++.h>
using namespace std;
//for(int i = 0; i < n; i++)
 
int main() {
  int n, a, b, ans = 0;
  long long x;
  cin >> a >> b >> x;
  for(int i = 0; i < 10; i++) {
    x = x * a - b;
    cout << x << endl;
  }
  //cout << ans << endl;
}

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


int main() {

  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  
  vector<long long> A(X);
  for (int i = 0; i < X; i++) {
    cin >> A[i];
  }

  vector<long long> B(Y);
  for (int i = 0; i < Y; i++) {
    cin >> B[i];
  }

  vector<long long> C(Z);
  for (int i = 0; i < Z; i++) {
    cin >> C[i];
  }

  // C は大きい順に並び替えておく
  sort(C.begin(), C.end(), std::greater<long long>());

  // A + B を全部作る
  vector<long long> AB;
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < Y; j++) {
      AB.push_back(A[i] + B[j]);
    }
  }

  // A + B を大きい順に並び替える
  sort(AB.begin(), AB.end(), std::greater<long long>());

  // (A + B) + C を作る
  // (A + B) は、大きい方から K 個と(A + B)の個数との小さい方を使う
  vector<long long> ABC;
  for (int i = 0; i < min(K, (int) AB.size()); i++) {
    for (int j = 0; j < Z; j++) {
      ABC.push_back(AB[i] + C[j]);
    }
  }

  // (A + B) + C を大きい順に並び替える
  sort(ABC.begin(), ABC.end(), std::greater<long long>());

  // 出力する
  for (int i = 0; i < K; i++) {
    cout << ABC[i] << endl;
  }

  return 0;

}


Measured memory_bytes: 43368
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    reverse(a,a+n);
    int al = 0, bo = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            al += a[i];
        }else{
            bo += a[i];
        }
    }
    cout << al - bo << endl;
}

Measured memory_bytes: 256
K = int(input())
if K % 2 == 0:
    print(-1)
    exit()
if K % 5 == 0:
    print(-1)
    exit()

d = 7
cnt = 1
mo = d % K
while mo != 0:
    d *= 10
    d %= K
    mo = (mo + d)%K
    cnt += 1
print(cnt)

Measured memory_bytes: 9164
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s;
int main() {
  // cin.ignore();
    int sum=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
       sum+=s[i]-'0';
    }

    if(sum%9==0){
       cout<<"Yes"<<endl;
    }
    else{
       cout<<"No"<<endl;
    }

}

Measured memory_bytes: 3724
#include<stdio.h>
 
int main(){
    int n,i,l,r,x=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d%d",&l,&r);
        x+=(r-l+1);
    }
    printf("%d\n",x);
    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
const int INF = (1 << 30);
const ll INFL = (1LL << 62);
const ll MOD = 1000000007;
template <class T>
bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T>
ll mod_pow(ll a, ll n, T mod) {
    mod = (ll)mod;
    ll res = 1, p = a % mod;
    while (n) {
        if (n & 1) res = res * p % mod;
        p = p * p % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> strong = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
    int A, B;
    cin >> A >> B;
    int alice, bob;
    rep(i, strong.size()) {
        if (strong[i] == A)
            alice = i;
        if (strong[i] == B)
            bob = i;
    }
    if (alice > bob)
        cout << "Alice" << endl;
    else if (alice == bob)
        cout << "Draw" << endl;
    else
        cout << "Bob" << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << '\n'

typedef int64_t Int;
const double pi = M_PI;

using namespace std;

int main() {
    string n;
    cin >> n;

    bool ans = false;
    if (n[0] == n[1] && n[0] == n[2] || n[1] == n[2] && n[1] == n[3]) {
        ans = true;
    }

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


Measured memory_bytes: 256
//=================================
// Created on: 2018/09/21 23:10:49
//=================================
#include <iostream>
#include <vector>
int main()
{
    int N;
    std::cin >> N;
    std::vector<int> A(N);
    for (int i = 0; i < N; i++) { std::cin >> A[i]; }
    int ans = 0;
    for (;; ans++) {
        for (int i = 0; i < N; i++) {
            if (A[i] % 2 == 1) { return std::cout << ans << std::endl, 0; }
            A[i] /= 2;
        }
    }
}


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

const int MAXNN = 1e2+5;
const int MAXN  = 1e5+5;
int val[MAXNN],weight[MAXNN];
#define ll long long

ll dp[MAXN][2];

int main()
{
    int n,cap;cin >> n >> cap;
    for(int i=1;i<=n;++i){
        cin >> val[i] >> weight[i];
    }
    for(int i=1;i<=n;++i){
        int now = i%2,last = 1-now;
        for(int j=0;j<=cap;++j){
            if(j>=val[i]){
                dp[j][now] = dp[j-val[i]][last] + weight[i];
            }
            dp[j][now] = max(dp[j][now],dp[j][last]);
        }
    }
    cout << dp[cap][n%2];
}


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

struct word{
  char name[32];
  int num;
};

int main(void)
{
  struct word a[1000];
  char buf[32],max1[32],long1[32];
  int i=0,j,queue=0,flag,length;
  int max;
  while(scanf("%s",buf)!=EOF){
    flag=0;
    for(i=0;i<queue;i++)
      if(strcmp(buf,a[i].name)==0){
	a[i].num++;
	flag=1;
      }
    if(flag==0){
      strcpy(a[queue].name,buf);
      a[queue].num=1;
      queue++;
    }
    //rewind(stdin);
    
    //  strcpy(a[i++].name,buf);
  }
  /*
  for(j=0;j<=queue;j++)
    printf("%s\n",a[j].name);
  */
  //出現頻度を求める
  max=0;  
  for(i=0;i<queue;i++)
    if(a[i].num>max){
      max=a[i].num;
      strcpy(max1,a[i].name);
    }
  length=0;
  for(i=0;i<queue;i++)
    if(strlen(a[i].name)>length){
      length=strlen(a[i].name);
      strcpy(long1,a[i].name);
    }
  printf("%s %s\n",max1,long1);
  
  return 0;
}

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

#define pq priority_queue
#define mp make_pair
#define cauto const auto &

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

#define clr(ar, val) memset(ar, val, sizeof(ar))

typedef long long int64;
typedef long long lint;
typedef long long lli;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;

typedef pair<int, int> pint;
typedef pair<long, long> plong;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;

const int iinf = 1 << 29;
const long long linf = 1ll << 61;

template <class T> bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T = int> T in() {
    T x;
    cin >> x;
    return (x);
}
template <class T> void print(T &x) {
    cout << x << '\n';
    return;
}

template <class T> ll sized_subset(T &comb) {
    T x = comb & -comb, y = x + comb;
    return ((comb & ~y) / x) >> 1 | y;
}

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

int a[3],b[3],c[3][3];
int main() {
    REP(i,3){
        REP(j,3){
            c[i][j]=in();
        }
    }
    a[0]=c[0][0],b[0]=0;
    b[1]=c[1][0]-a[0];b[2]=c[2][0]-a[0];
    a[1]=c[0][1];a[2]=c[0][2];
    REP(i,2){
        REP(j,2){
            if(a[i+1]+b[j+1]!=c[j+1][i+1]){print("No");return 0;}
        }
    }
    print("Yes");
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  string s;
  cin>>s;
  if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) {
    cout << "Yes" << endl;
    return 0;
  }

  if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) {
    cout << "Yes" << endl;
    return 0;
  }

  if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)

void solve() {
    int x;
    cin >> x;
    string s;
    cin >> s;
    int r = 0;
    int w = 0;
    for (char i : s) {
        if (i == 'R') {
            r++;
        }
    }
    int ans = 100000000;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == 'R') {
            r--;
        }
        if (i > 0 && s[i-1] == 'W') {
            w++;
        }
        ans = min(max(w, r), ans);
    }
    cout << ans;
}

//#define LOCAL 1

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

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    solve();

    return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

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

	int n, k, q;
	scanf("%d%d%d", &n, &k, &q);
	vector<int> cnt(n+1);
	for (int i = 0; i < q; i++) {
		int a;
		scanf("%d", &a);
		cnt[a]++;
	}
	for (int i = 1; i <= n; i++) {
		printf("%s\n", (k + cnt[i] - q > 0)? "Yes" : "No");
	}
}


Measured memory_bytes: 1024