akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int dp[3005][3005];

void chmax(int& a, int b) {
	a = max(a, b);
	return;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	s += '$';
	t += '#';
	rep(i, s.size())rep(j, t.size()) {
		chmax(dp[i + 1][j], dp[i][j]);
		chmax(dp[i][j + 1], dp[i][j]);
		if (s[i] == t[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
	}
	string ans;
	int i = s.size() - 1, j = t.size() - 1;
	while (i + j) {
		int x = dp[i][j];
		if (i && dp[i - 1][j] == x) {
			i--;
		}
		else if (j && dp[i][j - 1] == x) {
			j--;
		}
		else {
			i--; j--;
			ans += s[i];
		}
	}
	reverse(all(ans));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int pow(int x,int y){//x^yを返す
  long long tmp=x,res=1;
  while(y){
    if(y%2){res=res*tmp%MOD;}
    y>>=1;
    tmp=tmp*tmp%MOD;
  }
  return res;
}
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  long long dp[3020][3020][3];
  for(int i=A;i<=C;i++){
    for(int j=B;j<=D;j++){
      if(i==A && j==B){
        dp[i][j][1]=1;
      }
      else if(i==A){
        dp[i][j][0]=1;
        dp[i][j][1]=j-B;
        dp[i][j][2]=pow(A,j-B)-j+B-1+MOD;
      }
      else if(j==B){
        dp[i][j][1]=pow(B,i-A);
      }
      else{
        dp[i][j][1]=(dp[i-1][j][0]+dp[i-1][j][1]+dp[i-1][j][2])*j;
        dp[i][j][2]=dp[i][j-1][2]*i+dp[i][j-1][1];
      }
      dp[i][j][0]%=MOD;
      dp[i][j][1]%=MOD;
      dp[i][j][2]%=MOD;
    }
  }
  cout<<(dp[C][D][0]+dp[C][D][1]+dp[C][D][2])%MOD<<endl;
}

Measured memory_bytes: 215852
#include<stdio.h>

int main(void){
    int a,b,c,i,cnt;
    
    scanf("%d %d %d",&a,&b,&c);
    for(i=a;i<=b;i++){
       if(c%i==0){cnt++;}
    }
    printf("%d\n",cnt);
    return 0;
}


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

typedef long long ll;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

int main(){
    int A,B;
    cin >> A >> B;
    if (A==B){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main()
{
  int r;
  cin >> r;
  if(r < 1200)
  {
    cout << "ABC" << endl;
  }
  else if(r < 2800)
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        int answer = (a + b);
        if(answer % 2 == 0) System.out.println(answer/2);
        else System.out.println("IMPOSSIBLE");
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c,vector<int>(c));
    REP(i,c) REP(j,c) cin >> d[i][j];
    vector<vector<int>> md(3,vector<int>(c));
    REP(i,n) REP(j,n) {
        int x; cin >> x;
        x--;
        REP(k,c) md[(i+j)%3][k] += d[x][k]; 
    }
    
    int ans = 1 << 30;
    REP(i,c) REP(j,c) {
        if (i == j) continue;
        REP(k,c) {
            if (i == k || j == k) continue;
            ans = min(ans,md[0][i]+md[1][j]+ md[2][k]);
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
int main(void)
{
	int n,a[200001],i,j,m,f=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	std::sort(a,a+n);
	for(i=0;i<n;i++){
		if(a[i]==a[i+1]){
			f=1;
			break;
		}
	}
	if(f==1){
		printf("NO\n");
	}
	else{
		printf("YES\n");
	}
	return 0;
}

Measured memory_bytes: 896
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;



int main()
{
  string a, b;
  cin >> a >> b;
  if(sz(a) == sz(b) - 1) {
    for(int i = 0 ; i < sz(a) ; i++) {
      if(a[i] != b[i])
        return cout << "No" << endl, 0;
    }
    cout << "Yes" << endl;
  } else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

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

    int r, c, n;
    cin >> r >> c >> n;

    vector<pair<int, int>> p(n * 2);
    int k = 0;
    for (int i = 0; i < n; i++) {
        int m = 0;
        for (int j = 0; j < 2; j++) {
            int x, y;
            cin >> x >> y;
            if (x == 0 || x == r || y == 0 || y == c) {
                int u;
                if (y == 0) u = x;
                else if (x == r) u = r + y;
                else if (y == c) u = r + c + (r - x);
                else if (x == 0) u = r + c + r + (c - y);
                p[k++] = { u, i };
                m++;
            }
        }
        if (m < 2) k -= m;
    }

    sort(p.begin(), p.begin() + k);

    vector<int> v;
    v.reserve(n * 2);
    for (int i = 0; i < k; i++) {
        if (!v.empty() && p[i].second == v.back()) {
            v.pop_back();
        } else {
            v.push_back(p[i].second);
        }
    }

    cout << (v.empty() ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 2176
// Born Sinner
// old but im not that old
// fuck all you hoes get a grip
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;

public class Main
{
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
        long nextLong(){
            return Long.parseLong(next());
        }
        double nextDouble(){
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            } catch (Exception e){
                e.printStackTrace();
            }
            return str;
        }
    }
    static int modPower(int x, int y, int mod){
        int res = 1;
        x %= mod;
        if(x==0) return 0;
        while(y>0){
            if(y%2==1){
                res = (res*x)%mod;
            }
            y = y>>1;
            x = (x*x)%mod;
        }
        return res;
    }
    static class pair<T1, T2>{
        T1 first;
        T2 second;
        pair(T1 first, T2 second){
            this.first = first;
            this.second = second;
        }
    }
    static int gcd(int a, int b){
        if(b == 0) return a;
        return gcd(b, a%b);
    }

    public static void main (String[] args) throws java.lang.Exception
    {
        FastReader in = new FastReader();
        String s = in.nextLine();
        if(s.charAt(s.length() -1) == 's') {
            System.out.println(s + "es");
        } else {
            System.out.println(s + "s");
        }
    }
}


Measured memory_bytes: 36516
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(false);cin.tie();cout.tie();
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int T[200005];
int main()
{
    speed
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>T[i];
    sort(T+1,T+n+1);
    ll suma=0;
    for(int i=1;i<=n-k;i++)
        suma+=T[i];
    cout<<suma;
    return 0;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    M = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    print(2*M-N)




if __name__ == "__main__":
    main()

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

struct card {
	char s, n;
};

void printarray(card C[], int len) {
	for (int i = 0; i < len - 1; i++) {
		cout << C[i].s << C[i].n << " ";
	}
	cout << C[len - 1].s << C[len - 1].n << endl;
}

int main() {
	int N;
	cin >> N;
	card CB[N], CS[N];
	for (int i = 0; i < N; i++) {
		cin >> CB[i].s >> CB[i].n;
		CS[i].s = CB[i].s;
		CS[i].n = CB[i].n;
	}

	for (int i = 0; i < N; i++) {
		for (int j = N - 1; j > i; j--) {
			if (CB[j].n < CB[j - 1].n) {
				swap(CB[j], CB[j - 1]);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i + 1; j < N; j++) {
			if (CS[minj].n > CS[j].n) {
				minj = j;
			}
		}
		swap(CS[i], CS[minj]);
	}
	printarray(CB, N);
	cout << "Stable" << endl;
	printarray(CS, N);
	for (int i = 0; i < N; i++) {
		if (CB[i].s != CS[i].s) {
			cout << "Not stable" << endl;
			return 0;
		}
	}
	cout << "Stable" << endl;
	return 0;

}



Measured memory_bytes: 3092
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if((a*100+b*10+c)%4==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#define ll long long
using namespace std;

int main(){
    ll k, x;
    cin >> k >> x;
    if(500*k>=x){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (s[k-1]=='A')
        s[k - 1] = 'a';
    else if (s[k - 1] == 'B')
        s[k - 1] = 'b';
    else if (s[k - 1] == 'C')
        s[k - 1] = 'c';

    cout << s;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
lim = 10**9+7
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

print((pow(2,n,lim)-combination(n,a)-combination(n,b)-1) % lim)

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }

mt19937_64 rnd(time(NULL));



i64 n, a[202020];
void solve(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	i64 cnt = 0;
	for(int i = 1; i < n; i++){
		cnt += max(0LL, a[i-1]-a[i]);
		chmax(a[i], a[i-1]);
	}
	cout << cnt << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 5144
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>


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(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
    int to;
    T cost;
    Edge() {};
    Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
    int n;
    bool directed;
    vector<vector<Edge<T>>> edges;
public:

    Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)){};
    Graph() {};

    void add(int from,int to, T cost) {
        edges[from].emplace_back(to, cost);
        if(!directed){
            edges[to].emplace_back(from,cost);
        }
    }

    int size() {
        return n;
    }
};


int main() {

    long long A , B ,N;

    cin >> A >> B >> N;

    long long ans;

    if(N>=B){
        ans = (A*(B-1))/B;
    }else{
        ans = (A*N)/B;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

ll mod = 1000000007;

struct mint {
    ll x;
    mint(ll x = 0) : x(x % mod) {}
    mint& operator+=(const mint a) {
        (x += a.x) %= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        (x += mod - a.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;
    }
};

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

mint COM(ll n, ll k) {
    mint c(n);
    rep(i, k - 1) {
        n--;
        c *= n;
    }
    return c * finv[k];
}

mint twice(int n) {
    if (n == 0) return mint(1);
    if (n % 2 == 0) {
        mint res = twice(n / 2);
        res *= res;
        return res;
    }
    mint res = twice(n - 1) * 2;
    return res;
}

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

    int N, A, B;
    cin>>N>>A>>B;

    mint t = twice(N);
    t -= COM(N, A);
    t -= COM(N, B);
    cout<<t.x - 1<<endl;
}


Measured memory_bytes: 12160
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp make_pair
#define F first
#define S second
#define pf pop_front
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod=1e9+7;
const ll maxn=1000005;
const ll inf=1e9+7;
typedef pair<ll,ll> pii;
ll k,a,b;
int main()
{
    while(cin>>k>>a>>b)
    {
        bool flag=false;
        for(int i=a;i<=b;i++)
        {
            if(i%k==0) flag=true;
        }
        if(flag) cout<<"OK\n";
        else cout<<"NG\n";
    }
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;

#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1.0)

#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%lld\n",a)

#define stll(a) stoll(a,nullptr,10)
#define PII pair<ll,ll>
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define EL printf("\n")
#define ff first
#define ss second


#define mem(ar,val) memset(ar,val,sizeof(ar))
#define ssort(ar) sort(ar.begin(),ar.end())
#define csort(ar,comp) sort(ar.begin(),ar.end(),comp)

#define bug1(a) cout<<"test "<<a<<endl;
#define bug2(a,b) cout<<"test "<<a<<" "<<b<<endl;
#define bug3(a,b,c) cout<<"test "<<a<<" "<<b<<" "<<c<<endl;
#define bug4(a,b,c,d) cout<<"test "<<a<<" "<<b<<" "<<c<<" "<<d<<endl;

#define fout freopen("output.txt","w",stdout)
#define fin  freopen("input.txt","r",stdin)

/// unordered_map<int,int>mp;
/// mp.reserve(1024);
/// mp.max_load_factor(0.25);

/// pbds
/// *find_by_order(k) - return k th largest element.. 0 based
/// order_of_key(k) - number of items strictly smaller than k

/*
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return (size_t) x.first * 37U + (size_t) x.second;
  }
};
*/

typedef long long ll;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


int main()
{
    char n;
    cin>>n;
    if(n<='z'&& n>='a')
        cout<<"a"<<endl;
    else cout<<"A"<<endl;


}



Measured memory_bytes: 3632
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

K = ini()

s = "ACL"
ans = ""
for i in range(K):
    ans += s
print(ans)

Measured memory_bytes: 9064
#include<iostream>
            #include<vector>
            #include<climits>
            using namespace std;
            int frog(vector<int>& v, int k){
              if(v.size()==1)
                return v[0];
              vector<int> dp(v.size());
              dp[0]=0;
              dp[1]=abs(v[1]-v[0]);
              for(int i=2; i<int(v.size()); i++){
              	dp[i] = abs(v[i-1]-v[i])+dp[i-1];
                for(int j=2;j<=k && i-j>=0;j++){
                	dp[i] = min(dp[i], abs(v[i-j]-v[i])+dp[i-j]);
                }
                
              }
              return dp[v.size()-1];
            }
            int main(){
            	int n,k, tmp;
             	cin>>n>>k;
              	vector<int> v;
              	for(int i=0;i<n;i++){
                  cin>>tmp;
                  v.push_back(tmp);
                }
              cout<<frog(v, k);
            	return 0;
            }

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


int main()
{
    int n , A,B;
    cin>>n>>A>>B;
    string s;
    cin>>s;
    int currPass =0;
    int rankB = 0;
    for(int i=0;i<s.length() ;i++)
    {
        if( s[i] =='a'&& currPass <A+B)
        {
                currPass++;
                cout<<"Yes\n";
        }
        else if( s[i] =='b')
        {
            rankB++;
            if( currPass< A+B && rankB <= B )
            {
                currPass++;
                cout<<"Yes\n";
            }
            else cout<<"No\n";
        }
        else {
            cout<<"No\n";
        }
    }
}

Measured memory_bytes: 3716
class PriorityQueue
  def initialize
    @heapArr = []
  end

  def empty?
    @heapArr.empty?
  end

  def push(n)
    i = @heapArr.size

    while i>0
      p = (i-1)/2
      break if @heapArr[p] <= n
      @heapArr[i] = @heapArr[p]
      i=p
    end

    @heapArr[i] = n
  end

  def pop
    min = @heapArr[0]
    n   = @heapArr.pop
    unless @heapArr.empty?
      i   = 0
      while (i*2+1) < @heapArr.size
        if @heapArr[i*2+2].nil?
          buf=i*2+1
        else
          buf=(@heapArr[i*2+1]<@heapArr[i*2+2])?i*2+1:i*2+2
        end
        break if @heapArr[buf] >= n
        @heapArr[i] = @heapArr[buf]
        i=buf
      end
      @heapArr[i]=n
    end
    return min
  end

  def show
    level=0
    p=0
    while p<@heapArr.size
      (2**level).times do
        if @heapArr[p].nil?
          print "x "
        else
          print "#{@heapArr[p]} "
        end
        p+=1
      end
      puts ""
      level+=1
    end
    puts ""
  end
end
n, m = gets.split(' ').map(&:to_i)

works = Array.new(10**5 + 1) { [] }

n.times do
  a, b = gets.split(' ').map(&:to_i)
  works[a - 1] << b
end

ans = 0

queue = PriorityQueue.new

m.times do |i|
  works[i].each do |work|
    queue.push -work
  end

  ans -= queue.pop unless queue.empty?
end

puts ans


Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
int main(){
    int X;
    cin >> X;
    int x =X%7;
    string day[]={"thu","fri","sat","sun","mon","tue","wed"};
    for(int i=0;i<7;i++){
        if(i==x){
            cout << day[i]<<endl;
            break;
        }
    }
}


Measured memory_bytes: 3228
#include<iostream>
#include<vector>

int main(){
	int n,k,count=0;
	std::cin>>n>>k;

	std::vector<int> v(n);
	for (int& x : v) {
		std::cin >> x;
	}

	for (int i = 0; i < n; i++) {
		if (v[i] >= k) {
			count++;
		}
	}


	std::cout<<count<<std::endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string a,b;
    ll n,m;
    cin>>a>>b;
    n=a.length();
    m=b.length();
    ll has[n+1][m+1]={{0}};
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=m;j++)
        {
            has[i][j]=0;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
        {
            if(a[i-1]==b[j-1])
            {
                has[i][j]=has[i-1][j-1]+1;
                
            }
            else
            {
                has[i][j]=max(has[i-1][j],has[i][j-1]);
            }
        }
    }
    ll i=n,j=m;
    string ans="";
    while(i>0&&j>0)
    {
        if(has[i][j]==has[i-1][j])
        {
            i--;
        }
        else if(has[i][j]==has[i][j-1])
        {
            j--;
        }
        else {
            i--;j--;
            ans+=a[i];
        }
    }
    if(ans.length()==0)
    {cout<<"";return 0;}
    for(ll i=ans.length()-1;i>=0;i--)
    {
        cout<<ans[i];
    }
    
    return  0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int N;
  cin >> N;
  vi64 A(N), B(N);
  cin >> A >> B;
  i64 cnt;
  {
    cnt = accumulate(all(B), 0ll) - accumulate(all(A), 0ll);
    if (cnt < 0) no();
  }
  i64 acnt = cnt, bcnt = cnt;
  rep(i, N) {
    i64 a = A[i], b = B[i];
    i64 c = 0;
    if (a < b) {
      c += (b - a + 1) / 2;
      a += c * 2;
      acnt -= c;
    }
    if (a > b) {
      c += a - b;
      bcnt -= a - b;
    }
    A[i] = a, B[i] = b;
  }
  if (acnt >= 0 && bcnt >= 0) yes(); no();
}


Measured memory_bytes: 892
#include <stdio.h>

int main(){
    int matrix[3][3];
    char x;
    
    for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            scanf("%d", &matrix[i][j]);
        }
    }
    
    int n;
    scanf("%d", &n);
    
    int input[n];
    for(int k=0; k < n; k++){
        scanf("%d", &input[k]);
        for(int i=0; i<3; i++){
            for(int j=0; j<3; j++){
                if(input[k] == matrix[i][j]){
                    matrix[i][j] = x;
                }
            }
        }
    }
    
    int ctr[8] = {0};
    int last=2;
    
    for(int i=0; i<3; i++){
        if(matrix[i][0]==x){
            ++ctr[0];
        }
        if(matrix[i][2]==x){
            ++ctr[1];
        }
        if(matrix[0][i]==x){
            ++ctr[2];
        }
        if(matrix[2][i]==x){
            ++ctr[3];
        }
        if(matrix[i][i]==x){
            ++ctr[4];
        } 
        if(matrix[i][last--]==x){
            ++ctr[5];
        }
        if(matrix[1][i]==x){
            ++ctr[6];
        }
        if(matrix[i][1]==x){
            ++ctr[7];
        }
    }
    
    int flag = 0;
    
    for(int i=0; i<8; i++){
        if(ctr[i] == 3){
            flag = 1;
        }
    }
    printf("%s\n", (flag == 1) ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
 typedef pair<int,int> ii;
 typedef vector<ii> vii;
 typedef vector <int > vi;
//vector <vi> adj(MAX); 
priority_queue<ll> v1,v2,v3,v4,v5,v6;
//multimap<ll,ll> m1,m2;
int knapSack(int W, int wt[], int val[], int n)
{
   int i, w;
   int K[n+1][W+1];
 
   // Build table K[][] in bottom up manner
   for (i = 0; i <= n; i++)
   {
       for (w = 0; w <= W; w++)
       {
           if (i==0 || w==0)
               K[i][w] = 0;
           else if (wt[i-1] <= w)
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]);
           else
                 K[i][w] = K[i-1][w];
       }
   }
 
   return K[n][W];
}
int main()
{
// freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 ios::sync_with_stdio(false);
 cin.tie(0);
 ll a,b,c,n,m;
 int arr[1000]={0};
 cin>>m>>n;
 for(ll i=0;i<n;i++)
 {
  cin>>a>>b;
  //cout<<a<<" "<<b<<endl;

  arr[a]++;
  arr[b]++;
  //cout<<arr[a]<<" "<<arr[b]<<endl;
 }
 for(ll i=1;i<=m;i++)
  cout<<arr[i]<<endl;
 
return 0;
}


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

int main(void){
	int n;
	cin >> n;
	vector<int> v(n), c(n);
	for(auto& x : v){
		cin >> x;
	}
	for(auto& x : c){
		cin >> x;
	}
	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(v[i]-c[i]>0){
			ans += v[i]-c[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxn 2005
#define maxl 1000000000

using namespace std;

#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()

template <class T>
void mini(T& l, T r) {
  l = min(l, r);
}
template <class T>
void maxi(T& l, T r) {
  l = max(l, r);
}

using LL = long long;
using LD = long double;
using ULL = unsigned long long;
const int dx[] = {0, -1, 1, 0, -1, -1, 1, 1},
          dy[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const int INF = 1e9;
const LL MOD = 1e9 + 7;

int t, T;

void Solve() {
  // TODO
  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n - 1; i++) {
    cin >> b[i];
  }
  int res = b[n - 2];
  for (int i = 0; i < n - 1; i++) {
    res += (i > 0) ? min(b[i - 1], b[i]) : b[i];
  }
  cout << res << '\n';
  return;
}

void Prepare() {
  // TODO
  return;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  // Prepare();
  // cin >> T;
  // for (t = 1; t <= T; t++) {
  //   printf("Case #%d: ", t);
  Solve();
  // }
  return 0;
}

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

int main(){
    int n, m;
    while(cin >> n >> m, n+m){
        int mx = 1, my = 1;
        int direction = 1;
        while(1){
            string command; int step;
            cin >> command;
            if(command == "FORWARD"){
                cin >> step;
                if(direction == 1) my += step;
                else if(direction == 2) mx += step;
                else if(direction == 3) my -= step;
                else if(direction == 4) mx -= step;
            }
            else if(command == "BACKWARD"){
                cin >> step;
                if(direction == 1) my -= step;
                else if(direction == 2) mx -= step;
                else if(direction == 3) my += step;
                else if(direction == 4) mx += step;
            }
            else if(command == "RIGHT"){
                direction++;
                if(direction == 5) direction = 1;
            }
            else if(command == "LEFT"){
                direction--;
                if(direction == 0) direction = 4;
            }
            else if(command == "STOP")break;

            if(mx < 1) mx = 1;
            else if(mx > n) mx = n;
            if(my < 1) my = 1;
            else if(my > m) my = m;
        }
        cout << mx << " " << my << endl;
    }
}

Measured memory_bytes: 1216
#include <string>
#include <iterator>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>

using namespace std;

string GetStr()
{
	string str;
	getline(cin,str);
	return str;
}

vector<int> GetIntVector()
{
	string str;
	getline(cin,str);
	istringstream line( str );

	istream_iterator<int> iit(line);
	istream_iterator<int> iit_eof;

	vector<int> ret;

	for(;iit != iit_eof; iit++){
		ret.push_back(*iit);
	}

	return ret;
}

typedef struct 
{
	int n,count;
} HANAFUDA;

HANAFUDA GetSituation()
{
	HANAFUDA h;
	vector<int> v = GetIntVector();
	h.n = v[0];
	h.count = v[1];

	return h;
}

bool true_func(int dummy){return true;}

void solve(HANAFUDA h)
{
	vector<int> data(h.n);
	for(int i = 0; i < h.n; i++){
		data[i] = h.n - i;
	}

	for(int i = 0; i < h.count; i++){
		vector<int> inputs = GetIntVector();
		rotate( data.begin(), data.begin() +(inputs[0] - 1), data.begin() + (inputs[0] + inputs[1] - 1) );
	}

	cout << data[0] << endl;
}

void Hanafuda()
{
	HANAFUDA h = GetSituation();
	while(h.n != 0 && h.count != 0){
		solve(h);
		h = GetSituation();
	}
}


int main()
{
	Hanafuda();

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

void dfs(int x, int d, vector<vector<int>> &edge, vector<int> &dist){
    if(dist[x]>0){
        return;
    }
    dist[x]=d;

    for(auto &e:edge[x]){
        dfs(e, d+1, edge, dist);
    }
}

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int N;
    cin >> N;
    vector<vector<int>> edge(N,vector<int>(0));
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        a--;b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    vector<int> dist(N,-1);
    dfs(0, 0, edge, dist);

    //cout_vec(dist);
    int x, d;
    d=0;
    for(int i=0; i<N; i++){
        if(dist[i]>d){
            d=dist[i];
            x=i;
        }
        dist[i]=0;
    }
    //cout_vec(dist);

    dfs(x, 0, edge, dist);
    int dia=0;
    for(int i=0; i<N; i++){
        dia=max(dia,dist[i]);
    }
    //cout_vec(dist);
    if(dia%3==1){
        cout << "Second" << endl;
    }else{
        cout << "First" << endl;
    }
}

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

int main() {
  int H, W;
  scanf("%d%d", &H, &W);

  vector<string> p(H);
  for (int i = 0; i < H; i++) {
    cin >> p.at(i);
  }

  for (int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;

  for (int i = 0; i < H; i++) {
    cout << '#' << p.at(i) << '#' << endl;
  }

  for (int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ins insert
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define up_b upper_bound
#define low_b lower_bound
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,a,b) for(int i=b;i>=a;i--)
#define boost ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL)
#define nl '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;

const int N=9;
const int MXN=1501;

ld dis(ld x,ld y,ld a,ld b){
  return sqrt((x-a)*(x-a)+(y-b)*(y-b));
}

ld x[N],y[N];
int a[N];

int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>x[i]>>y[i];
    a[i]=i;
  }
  ld sum=0;
  ld cnt=0;
  do{
    ld dist=0;
    cnt++;
    for(int i=1;i<n;i++){
      dist+=dis(x[a[i]],y[a[i]],x[a[i+1]],y[a[i+1]]);
    }
    sum+=dist;
  }while(next_permutation(a+1,a+n+1));
  cout<<fixed<<setprecision(6)<<sum/cnt;
}


Measured memory_bytes: 256
n = gets.to_i
a, b = Array.new(n){gets.split.map(&:to_i)}.transpose.map(&:sort)
if n.even?
	amid = (a[n / 2 - 1] + a[n / 2]).to_r / 2
	bmid = (b[n / 2 - 1] + b[n / 2]).to_r / 2
	puts ((bmid - amid) * 2 + 1).to_i
else
	amid = a[n / 2]
	bmid = b[n / 2]
	puts (bmid - amid) + 1
end

Measured memory_bytes: 36124
//Christmas Eve

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    int n,k;cin>>n>>k;
    vector<int>h(n);
    rep(i,0,n)cin>>h[i];
    sort(range(h));
    int ans=inf;
    rep(i,0,n-k+1){
        ans=min(ans,h[i+k-1]-h[i]);
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define ifnot(x) if(not(x))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int N;
int A[100001];
bool ts[100001];

void solve() {
  cin >> N;
  rep(i, N) {
    cin >> A[i+1];
  }
  sort(A+1, A+N+1);
  ll sum = 0;
  rep2(i, 1, N) {
    sum += A[i];
    ts[i] = (sum * 2 < A[i + 1]);
  }
  int t = 0;
  rrep2(i, 1, N) {
    if(ts[i]) {
      t = i;
      break;
    }
  }
  cout << N - t << endl;
}

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

Measured memory_bytes: 768
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const int 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; }

template<typename T>
void print_vec(const vector<T> &v){
  int sz = v.size();
  for(int i=0; i < sz; i++){
    cout << v[i];
    if(i != sz-1) cout << " ";
  }
  cout << "\n";
}

int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for(auto &a : A) cin >> a;
  rep(i, n){
    int j = i-1;
    int v = A[i];
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    print_vec(A);
  }
  return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

typedef pair<double,double> xy;
const double INF = 1e9;

double getTilt(xy p, xy q) {
    if (p.first == q.first && p.second == q.second) {
        return -INF;
    }else if (p.first == q.first) {
        return INF;
    }else {
        return (q.second-p.second)/(q.first-p.first);
    }
}

void solve68(int n) {
    vector<xy> points;
    double x,y;
    REP(i,n) {
        scanf("%lf,%lf",&x,&y);
        points.push_back(make_pair(x, y));
    }
    sort(ALL(points));
    vector<xy> peri;
    peri.push_back(points[0]);
    double maxTilt;
    double tmpMax;
    int tmpMaxPoint;
    double tilt;
    maxTilt = 2*INF;
    while(!(peri.size() >= 4 && peri.front() == peri.back())) {
        tmpMax = -INF;
        tmpMaxPoint = -1;
        xy back = peri.back();
        REP(i,points.size()) {
            tilt = getTilt(back, points[i]);
            if (tilt < maxTilt && tilt > tmpMax) {
                tmpMax = tilt;
                tmpMaxPoint = i;
            }
        }
        if (tmpMaxPoint == -1) {
            maxTilt = 2*INF;
            tmpMax = INF;
        }else {
            maxTilt = tmpMax;
            peri.push_back(points[tmpMaxPoint]);
        }
    }
    cout << n - peri.size() + 1 << endl;
}

int main() {
    int n;
    while (cin >> n, n) {
        solve68(n);
    }
    return 0;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
#include<limits.h>
using namespace  std;
typedef long long int ll;
typedef long double ld;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define fi first
#define se second
#define rsz(a,n) a.resize(n)
#define test(t) ll t;cin>>t;while(t--)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define fillv(a,k) memset(a,k,sizeof(a))
#define filla(a,k,n) memset(a,k,sizeof(a[0])*n)
#define leadzero(a) __builtin_clz(a) //count leading zeros
#define trailzero(a) __builtin_ctz(a) //count trailing zeros
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln cout<<"\n"
#define sp cout<<" "
#define spaceprint(a,i,s,n) {forsn(i,s,n) { cout<<a[i]; sp;}}
#define lineprint(a,i,s,n) {forsn(i,s,n) {cout<<a[i]; ln;}}
#define maxe(a) *max_element(a.begin(),a.end())
#define maxi(a) max_element(a.begin(),a.end())-a.begin()
#define mine(a) *min_element(a.begin(),a.end())
#define mini(a) min_element(a.begin(),a.end())-a.begin()
#define all(c) c.begin(),c.end()
#define trav(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element)  (find(all(container),element) != container.end())// check the presence of element
//copy(from_begin, from_end, to_begin); copy function
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<string> vs;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
#define sumv(v) accumulate(all(v),ll(0))
#define productv(v) accumulate(all(v), ll(1), multiplies< ll >())
int main()
{
	ll n;
	cin>>n;
	ld p[n+1];
	fillv(p,0);
	for(ll i=1;i<=n;i++)
	{
		cin>>p[i];
	}
	ld dp[n+1][n+1];
	fillv(dp,0);
	dp[0][0]=1;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=0;j<=i;j++)
		{
			if(j!=0)
			dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
		else
			dp[i][j]=dp[i-1][j]*(1-p[i]);
		}
	}
	ld ans=0;
	for(ll i=n/2+1;i<=n;i++)
	{
		ans+=dp[n][i];
	}
	cout<<setprecision(20)<<ans<<endl;
}

Measured memory_bytes: 140928
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  n <- (read::String -> Int) <$> getLine
  arr <- map (read::String -> Int) . words <$> getLine
  print $ foldl (\acc n -> acc + calcLog n 2) 0 arr
  

calcLog::Int -> Int -> Int
calcLog x y = if x `mod` y == 0 
  then 1 + calcLog (x `div` y) y
  else 0


Measured memory_bytes: 7548
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>

typedef long long ll;

using namespace std;

int main(){
    ll n, k;
    cin >> n >> k;
    ll a = n % k;
    if(a == 0){
        cout << 0 << endl;
        return 0;
    }
    ll ans = min(a, k - a);
    cout << ans << endl;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=3e5+7;
#define pii pair<int,int>

pii a[maxn];
pii merge(pii a, pii b)
{
    pii c;
    if(a.first<b.first) swap(a,b);
    c.first=a.first;
    c.second=max(a.second,b.first);
    return c;
}
int main()
{
    int n;
    cin>>n;
    int pow2=(1<<n);
    for(int i=0,x;i<pow2;++i)
    {
        cin>>x; a[i]={x,0};
    }
    for(int j=0;j<n;++j)
    {
        for(int i=0;i<pow2;++i)
        {
            if((i>>j)&1) a[i]=merge(a[i],a[i^(1<<j)]);
        }
    }
    int ans=0;
    for(int i=1;i<pow2;++i)
    {
        print(max(ans,a[i].first+a[i].second));
        ans=max(ans,a[i].first+a[i].second);
    }
}

Measured memory_bytes: 5624
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

int a[10000][2000];

void run(){
    int n,m;
    cin>>n>>m;
    if(!n)return;
    int r;
    cin>>r;
    MEMSET(a);
    rep(_,r){
        int t,x,y,s;
        cin>>t>>x>>y>>s;
        y--;
        if(s)a[y][t]++;
        else a[y][t]--;
    }
    rep(i,m){
        rep(j,1999){
            a[i][j+1]+=a[i][j];
        }
    }
    int q;
    cin>>q;
    rep(_,q){
        int s,e,y;
        cin>>s>>e>>y;
        y--;
        int ans=0;
        Rep(i,s,e){
            ans+=a[y][i]!=0;
        }
        cout<<ans<<endl;
    }
    run();
}


Measured memory_bytes: 81156