akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e14;
using Graph = vector<vector<int>>;

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

  vector<int> plus;
  vector<int> minus;
  int kake = 1;
  for (int i = 0; i < N; i++){
    int A;
    cin >> A;
    if (A > 0) plus.push_back(A);
    else minus.push_back(A);
    kake *= A;
    kake %= MOD;
  }

  if (N == K){
    kake %= MOD;
    if (kake < 0) kake += MOD;
    cout << kake << endl;
    return 0;
  }

  sort(plus.rbegin(), plus.rend());

  int ans = 1;
  //正の数が1つもなかったら
  int m = (int)minus.size();
  if (plus.size() == 0){
    if (K % 2 == 1){
      sort(minus.rbegin(), minus.rend());
      for (int i = 0; i < K; i++){
        ans *= minus[i];
        ans %= MOD;
      }
    }
    else{
      sort(minus.begin(), minus.end());
      for (int i = 0; i < K; i++){
        ans *= minus[i];
        ans %= MOD;
      }
    }
  }
  else{ //正の数が一つ以上あったら
    sort(minus.begin(), minus.end());
    int cnt = 0;
    int pnow = 0;
    int mnow = 0;
    if (K % 2 == 1){
      ans *= plus[0];
      ans %= MOD;
      pnow++;
      cnt++;
    }
    while (cnt < K){
      int pkouho = -1;
      int mkouho = -1;
      if (pnow + 1 < (int)plus.size() ){
        pkouho = plus.at(pnow) * plus.at(pnow + 1);
      }
      if (mnow + 1 < (int)minus.size() ){
        mkouho = minus.at(mnow) * minus.at(mnow + 1);
      }
      if (pkouho > mkouho){
        pkouho %= MOD;
        ans *= pkouho;
        ans %= MOD;
        pnow += 2;
      }
      else{
        mkouho %= MOD;
        ans *= mkouho;
        ans %= MOD;
        mnow += 2;
      }
      cnt += 2;
    }
  }

  if (ans < 0){
    ans %= MOD;
    ans += MOD;
  }

  cout << ans << endl;
}


Measured memory_bytes: 5548
/*

*/
#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  int l[n];
  rep(i,n)cin>>l[i];
  int res=0;
  rep(i,n){
    rep2(j,i+1,n){
      rep2(k,j+1,n){
        vector<long long> v={l[i],l[j],l[k]};
        sort(v.begin(),v.end());
        //L i , L j , L k がすべて異なる
        //3 辺の長さが L i , L j , L k であるような三角形が存在する
        if (v[0] == v[1] || v[1] == v[2]) continue;
        if (v.back() < v[0] + v[1]) ++res;
      }
    }
  }
  cout<<res<<endl;
}

Measured memory_bytes: 3652
# coding: utf-8
def main():
    N = int(input())
    s = input()
    rcount = 0
    bcount = 0
    for si in s:
        if si == 'R':
            rcount += 1
        elif si == 'B':
            bcount += 1
    if rcount > bcount:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(std::string S, std::string T, long long A, long long B,
           std::string U) {
             if(S==U) cout << A-1 << " " << B << endl;
             else cout << A << " " << B-1 << endl;
           }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  long long A;
  std::cin >> A;
  long long B;
  std::cin >> B;
  std::string U;
  std::cin >> U;
  solve(S, T, A, B, U);
  return 0;
}


Measured memory_bytes: 3632
from collections import defaultdict
import time
n,m,k = map(int,input().split())
fr = defaultdict(set)
bl = []
start = time.time()
group = [0] * n
 
for _ in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  fr[a].add(b)
  fr[b].add(a)
 
for _ in range(k):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  bl.append((a,b))
 
 
g_num = 0
for i in range(n):
    if group[i] != 0:
        continue
    g_num += 1
    unvisited = set({i})
    while len(unvisited) > 0:
        v = unvisited.pop()
        group[v] = g_num
        for w in fr[v]:
            if group[w] > 0 or w in unvisited:
                continue
            unvisited.add(w)
 
group_size = defaultdict(int)
for x in group:
    group_size[x] += 1
 
bl_in_group = [0] * n
for a,b in bl:
    if group[a] == group[b]:
        bl_in_group[a] += 1
        bl_in_group[b] += 1
 
for i in range(n):
    print(group_size[group[i]] - len(fr[i]) - bl_in_group[i] - 1, end=' ')
 
print()

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

int main() {
  int n; cin >> n;
  vector<int> a(n);
  vector<bool> b(n);
  for (int& e: a) cin >> e;
  int now = 0;
  int next = a.at(0) - 1;
  int ans = 0;
  while (!b.at(next)) {
    ans++;             // ボタンを押す
    b.at(now) = true;  // 押したことが記録される
    now = next;        // 光っているボタンが移動
    next = a.at(next) - 1; // 次のボタンが確定
    if (now == 1) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 640
import sys
N, K = map(int, input().split())
a = sorted([int(input()) for i in range(N)])

ans = 10**10
for i in range(N-K+1):
    ans = min(ans, a[i+K-1]-a[i])
    if ans == 0:
        print(0)
        sys.exit()
print(ans)


Measured memory_bytes: 14096
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int P=1e9+7;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=5e5+5;
int a[N],b[N],c[N],n,res=1;
inline int min(R int x,R int y){return x<y?x:y;}
int main(){
	scanf("%d",&n);
	fp(i,1,n)scanf("%d",&b[i]);
	fp(i,1,n)scanf("%d",&c[i]);
	fp(i,1,n)if(b[i]!=b[i-1])a[i]=b[i];
	fd(i,n,1)if(c[i]!=c[i+1])a[i]=c[i];
	for(R int i=1,mx=0;i<=n;++i){
		cmax(mx,a[i]);
		if(mx!=b[i])return puts("0"),0;
	}
	for(R int i=n,mx=0;i;--i){
		cmax(mx,a[i]);
		if(mx!=c[i])return puts("0"),0;
	}
	fp(i,1,n)if(!a[i])res=mul(res,min(b[i],c[i]));
	printf("%d\n",res);
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);

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

  sort(L.begin(), L.end());
  ll ans = 0;
  // a < b < c
  for(int i = 0; i < L.size(); i++) {
    for(int j = i + 1; j < L.size(); j++) {
      int res = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
      ans += max(0, res - (j + 1));
    }

  }

  cout << ans << endl;
  return 0;

}

Measured memory_bytes: 256
s = list(map(str,input()))

s1 = s[:2]
s2 = s[2:4]

s1 = int("".join(s1))
s2 = int("".join(s2))
yy =0
mm=0


if 0<= s1 <=99 and 1<= s2 <= 12:
  yy +=1

if 0<= s2 <=99 and 1<= s1 <= 12:
  mm +=1
  
if yy ==1 and mm ==1:
  print("AMBIGUOUS")
elif yy==1:
  print("YYMM")
elif mm==1:
  print("MMYY")
else:
  print("NA")


Measured memory_bytes: 3060
import bisect

def main():
    N = int(input())

    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    # print(A,B,C)

    A.sort()
    B.sort()
    C.sort()

    def get_a(b):
        p = bisect.bisect_left(A, b)
        return p

    def get_c(b):
        """ bより大きい数がいくつあるか
        """
        p = bisect.bisect_right(C, b)
        return N - p

    cnt = 0
    for bi in B:
        x = get_a(bi) * get_c(bi)
        cnt += x

    print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 22720
from itertools import accumulate
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
rng = 100100
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
for i in range(1,rng):
  finv.append(pow(fctr[i],mod-2,mod))
def inv(x):
  return pow(x,mod-2,mod)

if n == 1:
  print(a[0])
  exit()

lse = []
lsc = []
for i in range(2,n+1)[::-1]:
  lse.append(fctr[n]*inv(i)%mod)
  if i == n:
    lsc.append(fctr[n]*inv(i)%mod)
    continue
  lsc.append(fctr[n]*inv(i)*inv(i+1)*2%mod)
acclse = list(accumulate(lse))
acclsc = list(accumulate(lsc))
ansls = [fctr[n]+sum(lse)]
x = ansls[-1]
ansls.append(x-lse[n-2]+lse[0]+acclsc[n-2]-acclsc[0])
for i in range(2,(n+1)//2):
  x = ansls[-1]
  ansls.append(x+acclsc[n-i-1]-acclsc[i-1]+lse[i-1]-lse[n-i-1])
ans = 0
for i in range(n):
  x = min(i,n-i-1)
  ans = (ans+a[i]*ansls[x])%mod
print(ans)

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

int sums(int n, int a, int b);
int main(void);

int sums(int n, int a, int b){
    int i, i_tmp, j, sum_one;
    int sum_nums = 0;
    for(i=1; i<n+1; i++){
        i_tmp = i;
        sum_one = 0;
        if(i==10000) sum_one=1;
        else{
        sum_one += i_tmp/1000;
        i_tmp -= (i_tmp/1000)*1000;
        sum_one += i_tmp/100;
        i_tmp -= (i_tmp/100)*100;
        sum_one += i_tmp/10;
        sum_one += i_tmp%10;
        }
        if(a<=sum_one && sum_one<=b)
           sum_nums += i;
    }

    return sum_nums;
}

int main(void){
    int n, a, b, sum;
    scanf("%d %d %d", &n, &a, &b);
    sum = sums(n, a, b);
    printf("%d\n", sum);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;

int main(){

    int N;
    int64_t sum = 0 ,ans = 0;
    int mod = 1000000000+7;
    int i,j;
    
    cin >> N;

    vector<int> a(N);

    for(i = 0;i<N;i++){
        cin >> a[i];
        sum = sum + a[i];
        sum = sum % mod;

    }

    for(i = 0;i<N;i++){
        
        sum = sum - a[i];
        if(sum < 0){
            sum = sum + mod;
        }

        ans = ans + a[i] * sum;

        ans = ans % mod;



    }


    cout << ans << endl;
         
 }

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;


int main(void) {
	int n, a, b; cin >> n >> a >> b;
	ll ans = 0;
	reps(i, 1, n + 1) {
		auto d = to_string(i);
		int k = 0;
		for(auto u : d) k += u - '0';
		if (a <= k && k <= b) {
			ans += i;
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N == 1) {
			System.out.println("Hello World");
		} else {
			int A = sc.nextInt();
			int B = sc.nextInt();
			System.out.println(A + B);
		}

	}

}


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

using namespace std;
#define ll         long long
#define f(n)       for(int i = 0; i < n; i++)
#define pb         push_back
#define mp         make_pair
#define vi         vector<int>
#define w(t)       while(t--)
#define all(v)     v.begin(),v.end()

int main()
{
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[2] == s[3] && s[4] == s[5]){
            cout << "Yes" << endl;
            break;
        }
        else{
            cout << "No" << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd_(ll a,ll b){if(a%b==0)return b;return gcd_(b,a%b);}
ll lcm_(ll a,ll b){ll c=gcd_(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e16)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
//tie(a,b,c) = make_tuple(10,9,87);
#define pop_(a) __builtin_popcount((a))
ll keta(ll a){ll r=0;while(a){a/=10;r++;}return r;}






int main(){
	int D;
	cin >> D;
	vector<int> c(26);
	FOR(i,0,26) cin >> c[i];

	FOR(i,0,D){
		cout << (i%26)+1 << endl;
	}

}



Measured memory_bytes: 3624
/*
  AUTHOR:SOURABH
  CREATED:10:01:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 998244353
#define MAX 100005
#define M 32

using namespace std;
using namespace __gnu_pbds;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("in.txt","r",stdin);
    //freopen(2 "out.txt","w",stdout);

    ll n,i,c=0;
    string s;
    cin>>n;
    cin>>s;
    fn(i,n-2)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
            c++;
    }
    cout<<c;
    return 0;
}






























Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();

    int sum = (r * 100) + (g * 10) + (b * 1);


    if (sum % 4 == 0){
    System.out.println("YES");
    }
    else {
      System.out.println("NO");
    }
  }
}


Measured memory_bytes: 21460
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
H,W,M = readInts()

dic1 = Counter()
dic2 = Counter()
s = set()
for i in range(M):
    h,w = map(lambda x:int(x)-1, input().split())
    dic1[h] += 1
    dic2[w] += 1
    s.add((h,w))
# print(dic)
ans = 0

# 重なっているもので最大値がある時もあれば
# 行、列の交差点でボムなしが一番大きいものがある
for h,w in s:
    ans = max(ans, dic1[h] + dic2[w] - 1)

dic1 = dic1.most_common()
dic2 = dic2.most_common()
max1 = dic1[0][1]
max2 = dic2[0][1]

for k1,v1 in dic1:
    if v1 < max1:
        break # continueする必要がない most_commonで大きい方から集めてるので
    for k2,v2 in dic2:
        if v2 < max2:
            break # 同じく
        if (k1,k2) in s: # 一度計算したもの
            continue
        # 両方とも最大であればok
        ans = max(ans, v1 + v2)
        break
print(ans)


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

class FirstGrader{
public:
	FirstGrader(int _N);
	~FirstGrader();
	long long int Execute();

private:
	int N;
	int num[100];
	long long int memo[100][21];
	enum PM{Plus, Minus};
	long long int correctEq(int index, int sum);
};

FirstGrader::FirstGrader(int _N) : N(_N){
	for (int i = 0; i < _N; i++){
		cin >> num[i];
	}
	// memoを-1で初期化
	for (int i = 0; i < 100; i++){
		for (int j = 0; j < 21; j++){
			memo[i][j] = -1;
		}
	}
}
FirstGrader::~FirstGrader(){};

long long int FirstGrader::correctEq(int index, int sum){
	if (index == N-2) {
		if (sum == num[N-1]) return 1;
		else return 0;
	}
	if (memo[index][sum] >=0) return memo[index][sum];

	memo[index][sum] = 0;
	if (sum + num[index + 1] <= 20) memo[index][sum] += correctEq(index+1, sum+num[index+1]);
	if (sum - num[index + 1] >= 0) memo[index][sum] += correctEq(index+1, sum-num[index+1]);

	return memo[index][sum];
}

long long int FirstGrader::Execute(){ return correctEq(0, num[0]); }

int main(){
	int N;
	cin >> N;
	
	FirstGrader* fg = new FirstGrader(N);
	cout << fg->Execute() << endl;
	
	delete fg;
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define PB push_back
#define PF push_front
#define MP make_pair
typedef long long int ll;
const ll mod = 1e9+7;
const ll INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    
    cout << min(a, min(b,c))<< ' ' << max(a, max(b,c)) << endl;

}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-4;
const double PI=3.1415926535897932;

LL d[100009];

int main(){
	LL n;scanf("%lld",&n);
	LL s=0;
	REP(i,n){
		scanf("%lld",&d[i]);s+=d[i];
	}
	LL dv=((LL)n*(LL)(n+1))/2;
	if(s%dv!=0){printf("NO");return 0;}
	LL m=s/dv;
	LL v2=0;
	REP(i,n){
		//d[(i+1)%n]-d[i]=m-n*x[i];
		if((m-(d[(i+1)%n]-d[i]))%n!=0){
			printf("NO");return 0;
		}
		if(m-(d[(i+1)%n]-d[i])<0){
			printf("NO");return 0;
		}
		v2+=(m-(d[(i+1)%n]-d[i]))/n;
	}
	if(v2!=m)printf("NO");
	else printf("YES");
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int H,W;
	while(true){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0) break;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
}



Measured memory_bytes: 2700
#include<iostream>

using namespace std;

int main(){
    int A, B, C, D;
    int minab, mincd;

    cin >> A >> B >> C >> D;

    if(A>B){
        minab = B;
    }else{
        minab = A;
    }

    if(C>D){
        mincd = D;
    }else{
        mincd = C;
    }
    cout << minab + mincd;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int X,Y,Z;
    scanf("%d %d %d",&X,&Y,&Z);
   if(2*X==Y+Z){
    printf("No\n");
   }else if(X==Y||X==Z||Y==Z){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 1648
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a > b)
	printf("a > b");
 if(a < b)
	printf("a < b");
	 if(a == b)
	printf("a == b");
	printf("\n");
	return 0;			
} 


Measured memory_bytes: 2128
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	int N = 5;
	vi x(N);
	rep(i, N)
		cin >> x[i];
	rep(i, N) {
		if (x[i] == 0)
			cout << i + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3616
def main():
    s = [int(char) for char in input()]
    l = len(s)
    k = int(input())

    tmp = 0
    nonzero = []
    for number in s:
        if number > 0:
            tmp += 1
        nonzero.append(tmp)
    nonzero.append(0)  # let nonzero[-1] be 0

    def binomial(n, k):
        if n < k or n < 0 or k < 0:
            return 0
        if k == 0:
            return 1
        if k == 1:
            return n
        if k == 2:
            return n * (n-1) // 2
        if k == 3:
            return n * (n-1) * (n-2) // 6
        raise ValueError

    def dp(i, _cache={-1: 0}):
        if i in _cache:
            return _cache[i]
        if nonzero[i-1] > k or s[i] == 0:
            result = dp(i-1)
            _cache[i] = result
            return result
        if nonzero[i-1] == k:
            result = dp(i-1) + 1
            _cache[i] = result
            return result
        result = (
            dp(i-1) +
            (s[i] - 1) * binomial(l - 1 - i, k - nonzero[i-1] - 1) *
            9 ** (k - nonzero[i-1] - 1) +
            binomial(l - 1 - i, k - nonzero[i-1]) *
            9 ** (k - nonzero[i-1])
        )
        _cache[i] = result
        return result
    
    print(dp(l-1) + (nonzero[l-1] == k))


main()


Measured memory_bytes: 3188
import sys
R = lambda:map(int,raw_input().split())

t2 = [[] for i in xrange(3)]
for i in xrange(3):
    t = []
    for j in xrange(8):
        num,time = raw_input().split()
        t.append((float(time),int(num)))
    t.sort()
    for j in xrange(4):
        t2[i].append(t[j])

t3 = []
for i in xrange(3):
        t3.append(t2[i][2])
        t3.append(t2[i][3])
t3.sort()

for i in xrange(3):
    print "%d %.2f" % (t2[i][0][1], t2[i][0][0])
    print "%d %.2f" % (t2[i][1][1], t2[i][1][0])

print "%d %.2f" % (t3[0][1], t3[0][0])
print "%d %.2f" % (t3[1][1], t3[1][0])

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

int N, C, K;
int T[100000];
int res;

int main() {
  cin >> N >> C >> K;
  for(int i = 0; i < N; ++i) cin >> T[i];
  sort(T, T + N);
  int i = 0;
  while(i < N) {
    int j = i;
    while(j < N && j - i < C && T[j] <= T[i] + K) ++j;
    ++res;
    i = j;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin - 1; end <= i; i--)		// repeat reverse

#endif


bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}


class ABC084D
{
public:
	ABC084D()
	{
		cin >> q;
		l.resize(q);
		r.resize(q);
		rep(i, 0, q)
			cin >> l[i] >> r[i];
	}
	void Run(void)
	{
		vector<bool> sosuu(100000);
		rep(i, 1, 100000)
			sosuu[i]= IsPrime(i);

		vector<ll> ans(100000);
		rep(i, 1, 100000)
		{
			if (i % 2 == 0)
				ans[i] = ans[i - 1];
			else
				ans[i] = (sosuu[i] && sosuu[(i + 1) / 2]) ? ans[i - 1] + 1 : ans[i - 1];
		}

		rep(i, 0, q)
			cout << ans[r[i]] - ans[l[i]-1] << endl;
	}
private:
	ll q;
	vector<ll> l, r;
};

int main(void)
{
	ABC084D abc084d;
	abc084d.Run();

	return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int infoNum = sc.nextInt();
		int smallPointSequence = 0;
		int smallPoint = 0;
		for(int i = 0; i < infoNum; i++) {
			int sequence = sc.nextInt();
			int point = sc.nextInt();
			if(sequence > smallPointSequence) {
				smallPointSequence = sequence;
				smallPoint = point;
			}
		}
		while(smallPoint > 0) {
			smallPointSequence++;
			smallPoint--;
		}
		System.out.println(smallPointSequence);
	}

}


Measured memory_bytes: 64856
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    private static void slove(long m[],int x){
        for(int i=0;i<3000;i++){
            for(int j=1;j<3000;j++){
                if(m[i]+m[j]==x){
                    System.out.print(i+" "+(-j));
                    return;
                }
                if(m[i]-m[j]==x){
                    System.out.print(i+" "+j);
                    return;
                }
            }
        }
    }
   /* public static StreamTokenizer in;
    static {
        try{
            in = new StreamTokenizer(new BufferedReader(new InputStreamReader(new BufferedInputStream(System.in))));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static int nextInt() throws IOException{ in.nextToken(); return (int)in.nval; }*/
    public static void main(String[] args) throws IOException{
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int x=sc.nextInt();
        long m[]=new long[3000];
        for(int i=0;i<m.length;i++)
            m[i]=(long)Math.pow(i,5);
        slove(m,x);



    }
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define vi vector<ll>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define el printf("\n")
#define pb push_back
#define f first
#define s second
#define arrondi(a) (long long)floor(a+0.5);
#define NIL -1
ll N=500005;
ll MAX=9223372036854775807;
ll MOD=1000000007;
long double PI =4*atan(1);

int main()
{
	IOS;
    cout.precision(30);
    int n; cin >> n; vector<ll> A(n,0);
    for (int i=0;i<n;i++)
    {
        cin >> A[i];
    }
    vector<ll> B=A;
    sort(A.begin(),A.end());
    ll nbr=0;
    for (int i=0;i<n;i++)
    {
        if (A[i]!=B[i])
        {
            nbr++;
        }
    }
    if (nbr<=2)
    {
        cout << "YES\n";
    }
    else cout << "NO\n";
    return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t x;
  string str;
  while(true){
      getline(cin, str);
      if(str.compare("0")==0) break;
      int count = 0;
      for(char &ch:str){
          count += ch - '0';
      }
      cout << count << endl;
  }
 
  return 0;
}


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

int N,A,B;
bool check(int n,vector<long long> h){
  long long zentai = (long long)B*n;
  vector<long long> nokori;
  for(int i=0;i<N;i++){
    h[i] -= zentai;
    if(h[i] > 0)
      nokori.push_back(h[i]);
  }
  if(nokori.size() == 0)return true;
  long long cnt = 0;
  for(int i=0;i<nokori.size();i++){
    cnt += (long long)ceil(1. * nokori[i] / (A-B));
  }
  if(cnt <= n)return true;
  return false;
}

int main(void) {
  cin >> N >> A >> B;
  vector<long long> h(N);
  for(int i=0;i<N;i++){
    cin >> h[i];
  }

  int low=0,hi=1e9,mid=0;
  while(hi > low+1) {
    mid = (low + hi)/2;
    if(check(mid,h)) {
      hi = mid;
    } else {
      low = mid;
    }
  }
  cout << low+1 << endl;

  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> s(N);
  for(int i=0; i<N; i++){
  	cin >> A[i];
  }
  for(int i=0; i<N; i++)s[A[i]-1]=i+1;
  for(int i=0; i<N; i++)cout << s[i] <<" ";
}

Measured memory_bytes: 1536
import math
N, D = map(int, input().split())
Xs = []
for i in range(N):
  X = list(map(int, input().split()))
  Xs.append(X)

r = 0
for i in range(N):
  for j in range(i+1, N):
    y, z= Xs[i], Xs[j]
    d2 = 0
    for k in range(D):
      d2 += (y[k]-z[k])*(y[k]-z[k])
    d = math.sqrt(d2)
    if d==int(d):
      r += 1
print(r)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std ;
typedef long long ll ;


int a[400005] ;
int b[200005] ;

int main(){
	int N , M , K ;
	cin >> N >> M >> K ;
	for(  int i = 0 ; i < N ; i++ ){
		cin >> a[i] ;
	}
	for( int i = 0  ; i < M ; i++ ){
		cin >> b[i] ;
	}
	ll sum = 0 ;
	int j = 0 ;
	for( j = 0  ; j < M ; j++ ){
		if( sum + b[j] <= K ) sum += b[j] ;
		else break ;
	}
	int ans = j ;
	j-- ;
	ll asum = 0 ;
	for( int i = 0  ; i < N ; i++ ){
		asum += a[i] ;
		while( j >= 0 && asum + sum > K ){
			sum = sum - b[j] ;
			j-- ;
		}
		if( asum + sum <= K  ){
			ans = max(i+j+2 , ans) ;
		}
	}
	cout << ans << endl ;


	
	return 0 ;
}

Measured memory_bytes: 5196
N = gets.chomp.to_i
A = gets.chomp.split(' ').map(&:to_i)

steps = []
h = A[0]
N.times do |i|
    if h > A[i] then
        steps[i] = h - A[i]
    else
        steps[i] = 0
        h = A[i]
    end
end

puts steps.sum

Measured memory_bytes: 31952
#include <stdio.h>


int main()
{

    int a[200001];
    int b;
    scanf("%d", &b);
    int c = 0;

    for (int i = 0; i < b; i++)
    {

        a[i]=0;
    }

    for (int i = 0; i < b-1; i++)
    {
        
        scanf("%d", &c);
        a[c-1]++;
    }

    for (int i = 0; i < b; i++)
    {

        printf("%d", a[i]);
        printf("\n");
    }


}

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

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

i64 a[2*maxn] ;

int main()
{
    i64 i , j , k , l , m , n ;

    scanf("%lld",&n) ;

    for(i=1 ; i<=n ; i++) scanf("%lld",&a[i]) ;

    for(i=1 ; i<=n ; i++) a[i] += a[i-1] ;

    i64 ans = abs( 2*a[1] - a[n] ) ;

    for(i=1 ; i<n ; i++) ans = min( ans , abs(2*a[i]-a[n]) ) ;

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

    return 0 ;
}


Measured memory_bytes: 1792
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  int x, mn = INF;
  REP(i,5){
    cin >> x;
    mn = min(mn,x);
  }

  cout << n/mn + (n%mn>0) + 4 << endl;

  return 0;
}

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

int ans=0;

int main(){
    int n;
    cin>>n;
    if(n==1) cout<<"Hello World"<<endl;
    else {
        int x,y;
        cin>>x>>y;
        cout<<x+y<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

int compare(int a, int b){
    if(a<b){
        return 1;
    } else if(a==b){
        return 0;
    }else {
        return -1;}
}

int main(void){

    int N,M;

    while(cin >> N >> M && N >0){
    vector<int> h(N,0);
    for(int i=0; i<N; ++i){scanf("%d",&h[i]);}
    vector<int> w(M,0);
    for(int i=0; i<M; ++i){scanf("%d",&w[i]);}
    
    int cnt = 0;

    for(int j=0; j<M; ++j){
        for (int i = 0; i<N; ++i){
            pair<int,int> a(i,j);
            int height = h[a.first];
            int width = w[a.second];
            while(a.first < N && a.second >= 0){
                switch(compare(height,width)){
                    case 1:{
                        if(a.first == N){goto next;}
                        ++a.first;
                        height += h[a.first];
                        break;
                    }
                    case 0:{
                        ++cnt;
                        if(a.first == N){goto next;}
                        ++a.first;
                        height += h[a.first];
                        break;
                    }
                    case -1:{
                        if(a.second == 0){goto next;}
                        --a.second;
                        width += w[a.second];
                    }
                }
            }
             next:;
        }
    }
    cout << cnt << endl;
}

    return 0;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
int cnt[100001];
int cnt2[100000];
int odd[100000];
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		int X;
		cin >> X;
		cnt[X]++;
	}
	for (int i = 1; i <= 100000; i++) {
		cnt2[i%M] += cnt[i];
		odd[i%M] += cnt[i]%2;
	}
	int ans = 0;
	for (int i = 1; i*2 < M; i++) {
		int m = min(odd[i], odd[M - i]);
		int d = abs(odd[i] - odd[M - i]);
		ans += m;
		cnt2[i] -= m;
		cnt2[M - i] -= m;
		odd[i] -= m;
		odd[M - i] -= m;
		if (odd[i] <= odd[M - i]) {
			int t = min(cnt2[i]/2, d/2)*2;
			ans += t;
			cnt2[i] -= t;
			cnt2[M - i] -= t;
			odd[M - i] -= t;
		} else {
			int t = min(cnt2[M - i]/2, d/2)*2;
			ans += t;
			cnt2[i] -= t;
			cnt2[M - i] -= t;
			odd[i] -= t;
		}
		ans += (cnt2[i] - odd[i])/2;
		ans += (cnt2[M - i] - odd[M - i])/2;
	}
	{
		int t = odd[0]/2;
		cnt2[0] -= t*2;
		odd[0] -= t*2;
		ans += t;
		ans += (cnt2[0] - odd[0])/2;
	}
	if(M%2 == 0) {
		int t = odd[M/2]/2;
		cnt2[M/2] -= t*2;
		odd[M/2] -= t*2;
		ans += t;
		ans += (cnt2[M/2] - odd[M/2])/2;
	}
	cout << ans << endl;
}

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

signed main() {
  int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    	std::string s(a,'0');
    	std::string t(w-a,'1');
        std::string ans=s+t;
  		std::string S(a,'1');
  		std::string T(w-a,'0');
  		std::string Ans=S+T;
  for(int i=0;i<h;++i){
    if(i<b){
    	printf("%s\n",ans.c_str());
    }
    else{
    	printf("%s\n",Ans.c_str());
    }
  }
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	ll n, a, b;
	scanf("%lld%lld%lld", &n, &a, &b);
	if (n == 1 && a == b)
		return printf("1\n"), 0;
	else if (n == 1 && a != b)
		return printf("0\n"), 0;
	if (b < a)
		return printf("0\n"), 0;

	printf("%lld\n", (b - a) * (n - 2) + 1);
}


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

int main()
{
  int a, b, c, n;
  cin >> a >> b >> c >> n;
  int i = 0;
  while(true) {
    //cout << a << ':' << b << ':' << c << ':' << i << endl;
    if(i > n) {
      cout << "No" << endl;
      break;
    }
    else if(a >= b) {
      b *= 2;
      i++;
      continue;
    }
    else if(b >= c) {
      c *= 2;
      i++;
      continue;
    }
    cout << "Yes" << endl;
    break;
  }
  return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(){
	unsigned long long n,x,max = 0;
	scanf("%lld",&n);
	for(int i = 0;i < 5;i++){
		scanf("%lld",&x);
		if((n - 1) / x > max) max = (n - 1) / x;
	}
	printf("%lld",max + 5);
	return 0;
}

Measured memory_bytes: 128
#include "stdio.h"

main(){

  int H, W;
  int i, j;

  scanf("%d %d", &H, &W);

  while(H != 0 && W != 0){

    for(i = 0; i < H; i++){
      for(j = 0; j < W; j++){

        if((i+j)%2 == 0)printf("#");
        else printf(".");

      }
      printf("\n");
    }
    printf("\n");

    scanf("%d %d", &H, &W);
  }


  return 0;

}



Measured memory_bytes: 2104
#include <iostream>
#include <string.h>

using namespace std;
int dp[102][102][2];

void solve()
{
	memset(dp, 0, sizeof(dp));
	for(int i = 1; i <= 100; ++i)
	{
		dp[1][i][0] = 1;
		dp[1][i][1] = 1;
		dp[i][1][0] = 1;
		dp[i][1][1] = 1;
	}
	for(int i = 2; i <= 100; ++i)
	{
		for(int j = 2; j <= 100; ++j)
		{
			dp[i][j][0] = (dp[i][j - 1][0] + dp[i - 2][j][1]) % 100000;
			dp[i][j][1] = (dp[i][j - 2][0] + dp[i - 1][j][1]) % 100000;
		}
	}
	int w, h;
	while(cin >> w >> h, w || h)
	{
		cout << (dp[h][w - 1][0] + dp[h - 1][w][1]) % 100000 << endl;
	}
}

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

Measured memory_bytes: 1248
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

int main() {
    int n, k; cin >> n >> k;

    if(k  == 1)
        cout << 0 << endl;
    else
        cout <<  n-k << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,sum[2000020][2],A[2000020];
int main(){
	scanf("%d",&n);
	int i;
	for (i=1;i<=n;i++){
		char ch; cin>>ch;
		if (ch=='W') A[i]=1,sum[i][1]++;
		else sum[i][0]++;
		sum[i][1]+=sum[i-1][1];
		sum[i][0]+=sum[i-1][0];
	}
	int ans=n;
	for (i=1;i<=n;i++)
		ans=min(ans,sum[i-1][1]+sum[n][0]-sum[i][0]);
	cout<<ans;

}

Measured memory_bytes: 5504
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int M = Integer.parseInt(sc.next());
        int count = 0;
        int total =0;
        ArrayList<Integer> l = new ArrayList<>();
        for(int i = 0; i < N ;i++){
            int num = Integer.parseInt(sc.next());
            total += num;
            l.add(num);
        }
        float border = total/(4f*M);
        for(Integer i : l){
            if((float)i >= border){
                count += 1;
            }
        }
        if(count >= M){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35564
import java.util.*;

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

      int n = Integer.parseInt(sc.next());

      String s = sc.next();
      int lng = s.length();
      for(int i=0;i<lng;i++){
        char input = s.charAt(i);
        int charInt = input;
        charInt += n;
        if(charInt>90){
          charInt -= 26;
        }
        input = (char)charInt;
        System.out.print(input);
      }

    }
}


Measured memory_bytes: 24848