akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
//priority_queue<int, vector<int>, greater<int> > pq;
#define _CRT_SECURE_NO_DEPRECATE
const int N = 105;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =  1e9+7;
const int M=25000;
int A[M];
int B[M];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 int n;
    cin >> n;
    for(int i = 1; i <= n ; i ++ ){
        A[i] = M * i;
        B[i] = M * (n - i + 1);
    }
    int p;
    for(int i = 1; i <= n; i ++ ){
        cin >> p;
        A[p] += i;
    }
    for(int i = 1; i <= n ; i ++ )
        cout << A[i] << " ";
    cout << "\n";
    for(int i = 1; i <= n ; i ++ )
        cout << B[i] << " ";

}

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

int main() {
  int A, B;
  cin >> A >> B;

  if (A + B == 3) {
    cout << 3 << endl;
  } else if (A + B == 4) {
    cout << 2 << endl;
  } else {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <numeric>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pdi = pair<double, int>;

int N;

int dfs(ll n) {
	if (n > N) return 0;
	bool is_357 = false;
	bool is_3 = false, is_5 = false, is_7 = false;
	for (int tmpn = n; tmpn > 0; tmpn /= 10)
	{
		switch (tmpn % 10)
		{
		case 3:
			is_3 = true;
			break;
		case 5:
			is_5 = true;
			break;
		case 7:
			is_7 = true;
			break;
		default:
			break;
		}
	}
	if (is_3 && is_5 && is_7) {
		is_357 = true;
	}
	return dfs(n * 10 + 3) + dfs(n * 10 + 5) + dfs(n * 10 + 7) + (is_357 ? 1 : 0);
}

int main() {
	cin >> N;
	//int tmpN = N;
	//vector<int> N_k;
	//while (tmpN != 0) {
	//	N_k.push_back(tmpN % 10);
	//	tmpN /= 10;
	//}

	cout << dfs(0) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007

using namespace std;

int n, m, t;

int main()
{
    cin >> n >> m;
    t = (n - m) * 100 + m * 1900;
    double ans = 0, p = 1;
    for (int i = 0; i < m; ++i)
        p /= 2;
    double hard = 1 / (p * p);
    cout << (int)(hard * t * p) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=400005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S,T;cin>>S>>T;
    int res=0;
    for(int i=0;i<si(S);i++) res+=(S[i]!=T[i]);
    
    cout<<res<<endl;
}


Measured memory_bytes: 3788
n,m = map(int, input().split())
a_list = list()
for i in range(n):
    a_list.append(list(map(int, input().split())))

b_list = list()
for i in range(m):
    b_list.append(int(input()))

import operator
for a_row in a_list:
    print(sum(list(map(operator.mul, a_row, b_list))))



Measured memory_bytes: 6092
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<set>
using namespace std;
const int M=(int)1e5+5;
const long long INF=(long long)1e17+7;
template<class T>void Rd(T &res){
	res=0;static char p;
	while(p=getchar(),p<'0');
	do{
		res=(res*10)+(p^48);
	}while(p=getchar(),p>='0');
}
template<class T>void Ps(T x){
	static int stk[65],sz;sz=0;
	while(x)stk[sz++]=x%10,x/=10;
	if(sz==0)stk[sz++]=0;
	while(sz--)putchar(stk[sz]^48);
}
int n,q;
struct W{
	int l,r;
	long long v;
	bool operator <(const W &a)const{
		if(r!=a.r)return r<a.r;
		if(l!=a.l)return l<a.l;
		return v<a.v;
	}
}A,B;
set<W>st;
set<W>::iterator it,it1;
int main(){
	Rd(n),Rd(q);
	long long x,y,ned;
	st.insert((W){0,0,INF});
	st.insert((W){1,n,0});
	for(int i=1;i<=q;i++){
		Rd(x),Rd(y);
		while(y){
			it=st.lower_bound((W){0,(int)x,0ll});
			A=(*it);
			st.erase(it);
			if(A.r>x)st.insert((W){(int)x+1,A.r,A.v}),A.r=x;
			it1=st.lower_bound((W){-1,A.l-1,0ll});
			B=(*it1);
			if(B.v!=INF)ned=(A.r-A.l+1)*(B.v-A.v);
			else ned=INF;
			if(ned<0)ned=INF;
			if(ned<=y){
				st.erase(it1);
				B.r=A.r;
				st.insert(B);
				y-=ned;
			}else {
				ned=A.r-A.l+1;
				if(y%ned==0){
					A.v+=y/ned;
					st.insert(A);
				}else {
					B.l=A.l,B.r=B.l+y%ned-1,B.v=A.v+y/ned+1;
					st.insert(B);
					A.l=B.r+1,A.v=B.v-1;
					st.insert(A);
				}
				y=0;
			}
		}
	}
	for(it=++st.begin(),it1=st.end();it!=it1;it++)
		for(int j=(*it).l;j<=(*it).r;j++)
			Ps((*it).v),putchar('\n');
	return 0;
}

Measured memory_bytes: 7680
N = int(input())
A = list(map(int,input().split()))

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b)

res = [0] * N
l = [0] * (N+1)
r = [0] * (N+1)

for i in range(N):
    l[i+1] = gcd(l[i],A[i])

for i in range(N,0,-1):
    r[i-1] = gcd(r[i],A[i-1])

for i in range(N):
    res[i] = gcd(l[i],r[i+1])

print(max(res))

Measured memory_bytes: 63856
import math

while(True):
	n = int(input())
	if n==0:
		break;
	list_str = input().split(' ')
	list_int = []
	sum = 0
	for value in list_str:
		newVar = float(value)
		sum += newVar
		list_int.append(newVar)
	sum /= n
	
	result = 0
	for value in list_int:
		result += (value - sum) * (value - sum)
		
	result = math.sqrt(result / n) if result != 0 else 0
	
	
	print('%.8f'%result)

Measured memory_bytes: 7812
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

typedef int Weight;
struct Edge{
    int from, to;
    Weight weight;
    int rev;     // 無向グラフの対の辺
    Edge(int from, int to, Weight weight) :
        from(from), to(to), weight(weight) { }
    Edge(int from, int to, Weight weight, int rev) :
        from(from), to(to), weight(weight), rev(rev){ }
};
bool operator < (const Edge &a, const Edge &b){
    if(a.weight != b.weight) return a.weight > b.weight;
    if(a.from != b.from) return a.from > b.from;
    return  a.to > b.to;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;
void addFlowEdge(Graph &g, int a, int b, Weight c){
    g[a].push_back(Edge(a, b, c, g[b].size()));
    g[b].push_back(Edge(b, a, 0, g[a].size() - 1));
}
void addUndirectedEdge(Graph &g, int a, int b, Weight c){
    g[a].push_back(Edge(a, b, c, g[b].size()));
    g[b].push_back(Edge(b, a, c, g[a].size() - 1));
}

bool isBipartite(const Graph &g, int v, int c, vector<int> &color) {
    color[v] = c;
    bool f = true;
    for(auto e: g[v]) {
        if (color[e.to] < 0) {
            f = f && isBipartite(g, e.to, 1 - c, color);
        } else if(color[e.to] != 1 - c) {
            return false;
        }
    }
    return f;
}

void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){
    Graph g(N + 1);
    for(int i = 0; i < M; ++i) {
        addUndirectedEdge(g, A[i], B[i], 0);
    }
    vector<int> c(N + 1, -1);
    bool f = isBipartite(g, 1, 0, c);
    if (f) {
        int a = 0;
        for(int i = 1; i <= N; ++i) {
            if (c[i] == 1) {
                a++;
            }
        }
        cout << max(a * (N - a) - M, 0LL) << endl;
    } else {
        cout << N * (N - 1) / 2 - M << endl;
    }
}

signed main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  for (int i = s.size(); i > 0; i--) {
    s.erase(s.size() - 1);
    if (s.size() % 2 != 0) continue;
    if (s.substr(0, s.size() / 2) == s.substr(s.size() / 2, s.size() / 2)) {
      cout << s.size();
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int N, K;
  	cin >> N >> K;
  	int dig = 0;

  	while(N){
  		dig++;
  		N /= K;
  	}
  	cout << dig <<endl;

  	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int m,f,r;
	while(1) {
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r==-1) break;
		if(m==-1 || f==-1) {
			printf("F\n");
		} else if(m+f>=80) {
			printf("A\n");
		} else if(m+f>=65) {
			printf("B\n");
		} else if(m+f>=50) {
			printf("C\n");
		} else if(m+f>=30) {
			if(r>=50) printf("C\n");
			else printf("D\n");
		} else {
			printf("F\n");
		}
	}
	return 0;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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




#define bit(n,k) ((n >> k) & 1)

int n,a[16];
PII testimonials[16][16];

int find_ans(int check)
{
    int i,j;
    for(i=0;i<n;i++)
    {
        if(bit(check,i))
        {
            for(j=0;j<a[i];j++)
            {
                if(bit(check,testimonials[i][j].FI) != testimonials[i][j].SE)return -1;
            }
        }
    }
    return __builtin_popcount(check);
}

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,j;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        for(j=0;j<a[i];j++)cin >> testimonials[i][j].FI >> testimonials[i][j].SE,--testimonials[i][j].FI;
    }
    int ans=0;
    for(i=0;i<(1 << n);i++)ans=max(ans,find_ans(i));
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io  ios_base::sync_with_stdio(false), cin.tie(NULL),cout.tie(NULL)
int mod=998244353;
int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	return (a+b)%m;}
int sub(int a,int b,int m=mod){	return (a-b+m)%m;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}

int32_t main()
{
    io;
    int t;
    t=1;
    while(t--)
    {
        int n,m,kk;
        cin>>n>>m>>kk;
        int m1=(1<<n),m2=(1<<m);
        string s[n];
        for(int i=0;i<n;i++)
        cin>>s[i];
        int ans=0;
        for(int i=0;i<m1;i++)
        {
            for(int j=0;j<m2;j++)
            {
                string ss[n];
                for(int k=0;k<n;k++)
                    for(int l=0;l<m;l++)
                    ss[k]+='a';
                for(int ii=0;ii<n;ii++)
                {
                    if(i&(1<<ii))
                    {
                        for(int k=0;k<m;k++)
                            ss[ii][k]='r';
                    }
                }
                for(int jj=0;jj<m;jj++)
                {
                    if(j&(1<<jj))
                    {
                        for(int k=0;k<n;k++)
                            ss[k][jj]='r';
                    }
                }
                int aa=0;
                for(int k=0;k<n;k++)
                    for(int l=0;l<m;l++)
                    if(ss[k][l]=='a' && s[k][l]=='#')
                    aa++;
                if(aa==kk)
                    ans++;
            }
        }
        cout<<ans<<"\n";
    }
}


Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int A = in.nextInt();
            for (int i = 1; i < 10; i++) {
                for (int j = 1; j < 10; j++) {
                    if (i * j == A) {
                        out.printLine("Yes");
                        return;
                    }
                }
            }
            out.printLine("No");
        }

    }

    static class OutputWriter {
        PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tokenizer = null;

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(in.readLine());
                }
                return tokenizer.nextToken();
            } catch (IOException e) {
                return null;
            }
        }

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

    }
}



Measured memory_bytes: 23380
#include<iostream>
#include<algorithm>
#include<map>

using namespace std;

int M,T,P,R;

class Trem {
public:

    int id;
    int AC_cnt;
    int WA_cnt[13];
    int time;
    bool is_AC[13];
    Trem() {
    }
    Trem(int i) {
        this->id = i;
        AC_cnt=0;
        time=0;
        for(int i=0;i<13;i++) {
            WA_cnt[i]=0;
            is_AC[i]=false;
        }
    }
    void submit(int m,int t,int p,int j) {
        if(j==0) {
            AC_cnt++;
            is_AC[p]=true;
            time += m;
            time += WA_cnt[p]*20;
        }
        else {
            WA_cnt[p]++;
            
        }
    }
    bool operator<(const Trem& t1) const {
        if(this->AC_cnt != t1.AC_cnt) {
            return this->AC_cnt > t1.AC_cnt;
        }
        if(this->time != t1.time) return this->time < t1.time;
        return this->id > t1.id;
    }

};

void solve() {
    Trem trem[53];
    for(int i=0;i<53;i++) trem[i]=Trem(i);
    for(int i=0;i<R;i++) {
        int m,t,p,j;
        cin>>m>>t>>p>>j;
        trem[t].submit(m,t,p,j);
    }
    sort(trem+1,trem+T+1);
    for(int i=1;i<=T;i++) {
        Trem t = trem[i];
        Trem next = trem[i+1];
        char c = ((t.AC_cnt==next.AC_cnt && 
                t.time == next.time)?'=':',');
        if(i==T) c='\n';
        cout<<t.id;
        cout<<(c);
    }

    

}

int main() {
    while(cin>>M>>T>>P>>R) {
        if(M+T+P+R==0) return 0;
        solve();
    }

    return 0;
}

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

int main(){
  int money = 100000, n;
  cin >> n;
  for(int i = 0;i < n;i++){
    money *= 1.05;
    if(money % 1000 > 0) {
      money -= money % 1000;
      money += 1000;
    }
  }

  cout << money << "\n";
  return 0;
}



Measured memory_bytes: 3096
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = scan.next();
        }
        scan.close();

        Set<String> strSet = new HashSet<String>();
        for (int i = 0; i < n; i++) {
            strSet.add(s[i]);
        }

        System.out.println(strSet.size());
    }
}


Measured memory_bytes: 73892
n=int(input())
l=list(map(int,input().split()))

cnt=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i] and abs(l[j]-l[k])<l[i] and l[i]<l[j]+l[k]:
        cnt+=1
        
print(cnt)

Measured memory_bytes: 73836
fun main(args: Array<String>) {
    val O = readLine()!!
    val E = readLine()!!

    val sb = StringBuilder()
    for (i in O.indices) {
        O[i].let { sb.append(it) }
        E.getOrNull(i)?.let { sb.append(it) }
    }

    println(sb.toString())
}



Measured memory_bytes: 33748
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		sc.close();

		int[] dp = new int[n];
		for (int i = 1; i < n; i++) {
			int min = Integer.MAX_VALUE;
			for (int j = Math.max(i - k, 0); j < i; j++) {
				min = Math.min(min, dp[j] + Math.abs(h[i] - h[j]));
			}
			dp[i] = min;
		}
		System.out.println(dp[n - 1]);
	}
}


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

int main() {
  ll a,b; cin >> a >> b;
  if(1<=a && a <= 9 && 1<=b && b <= 9)
    cout << a*b << endl;
  else
    cout << -1 << endl;
}

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

int main()
{ string s1 , s2 ,s3;
cin>>s1>>s2>>s3;
cout<<s1.at(0)<<s2.at(0)<<s3.at(0)<<endl;


    return 0;
}



Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
const int MaxN = 200003;
#define x0 Fuck_the_GCC_header_x0
#define y0 Fuck_the_GCC_header_y0
#define x1 Fuck_the_GCC_header_x1
#define y1 Fuck_the_GCC_header_y1
#define X first
#define Y second
int x0,x1,y0,y1,n,cnt;
#define M_PI 3.14159265358979323846
const double len=M_PI*20,len2=M_PI*10,len4=M_PI*5;
PII e[MaxN];
int a[MaxN],mn[MaxN];

int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    cin >> x0 >> y0 >> x1 >> y1 >> n;
    if (x0>x1) {swap(x0,x1);swap(y0,y1);}
    cout << fixed << setprecision(15);
    cnt=0;
    for (int i=1;i<=n;++i) {
        int x,y;
        cin >> x >> y;
        if (x<min(x0,x1) || x>max(x0,x1) || y<min(y0,y1) || y>max(y0,y1)) continue;
        cnt++;
        e[cnt].first=x,e[cnt].second=y;
    }
    if (x1==x0) {
        double ans=(long long)abs(y1-y0)*100LL;
        for (int i=1;i<=cnt;++i) if (e[cnt].X==x1) ans=ans-20LL+len2;
        cout << ans << endl;
        return 0;
    }
    if (y1==y0) {
        double ans=(long long)abs(x1-x0)*100LL;
        for (int i=1;i<=cnt;++i) if (e[cnt].Y==y1) ans=ans-20LL+len2;
        cout << ans << endl;
        return 0;
    }
    sort(e+1,e+cnt+1);
    //if (x1<x0) reverse(e+1,e+cnt+1);
    if (y1<y0) for (int i=1;i<=cnt;++i) e[i].Y=2LL*y0-e[i].Y;
    for (int i=1;i<=cnt;++i) a[i]=e[i].Y;
    for (int i=1;i<=cnt;++i) mn[i]=0x7fffffff;
    mn[0]=0x80000000;
    int sum=0;
    for (int i=1;i<=cnt;++i) {
        int x=lower_bound(mn,mn+cnt+1,a[i])-mn;
        mn[x]=a[i];
        sum=max(sum,x);
    }
    double ans=100LL*(abs(x0-x1)+abs(y0-y1));
    ans=ans-20*sum+len4*sum;
	if(sum==abs(x0-x1)+1||sum==abs(y0-y1)+1)
		ans=ans+len4;
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;

int main(){
	int x;
	cin >> x;
	if(x>= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 3632
x = int(input())
if 400 <= x and x <= 599:
    ans = 8
elif 600 <= x and x <= 799:
    ans = 7
elif 800 <= x and x <= 999:
    ans = 6
elif 1000 <= x and x <= 1199:
    ans = 5
elif 1200 <= x and x <= 1399:
    ans = 4
elif 1400 <= x and x <= 1599:
    ans = 3
elif 1600 <= x and x <= 1799:
    ans = 2
elif 1800 <= x and x <= 1999:
    ans = 1
print(ans)

Measured memory_bytes: 9192
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

struct UnionFind {
  VI par, rank, diff_weight;
  UnionFind(int n) {
    par = VI(n); iota(par.begin(), par.end(), 0);
    rank = VI(n, 0);
    diff_weight = VI(n, 0);
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      int r = root(par[x]);
      diff_weight[x] += diff_weight[par[x]];
      return par[x] = root(par[x]);
    }
  }
  bool unite(int x, int y, int w) {
    w += weight(x); w -= weight(y);
    x = root(x); y = root(y);
    if (x == y) { return false; }
    if (rank[x] < rank[y]) {
      assert(diff_weight[x] == 0);
      diff_weight[x] -= w;
      par[x] = y;
    } else {
      assert(diff_weight[y] == 0);
      diff_weight[y] += w;
      par[y] = x;
      if (rank[x] == rank[y]) { rank[x]++; }
    }
    return true;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int weight(int x) {
    root(x); return diff_weight[x];
  }
  int diff(int x, int y) {
    assert(same(x, y));
    return weight(y) - weight(x);
  }
};

signed main() {
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  REP (i, M) {
    int L, R, D;
    cin >> L >> R >> D; L--; R--;
    if (uf.same(L, R)) {
      if (uf.diff(L, R) != D) {
        cout << "No" << endl; return 0;
      }
    } else {
      uf.unite(L, R, D);
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    int n, d, x;
    cin >> n >> d >> x;
    vector<int> A(n);
    REP(i, n) cin >> A[i];
    int ans = x;
    for(int i = 1; i <= d; i++){
        REP(j, n) if ((i - 1) % A[j] == 0) ans++;
    }
    cout << ans << endl;

    return 0;
}


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

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

#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define int long long
#define sz(v) (int)v.size()
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define f(i,l,r) for(long long i=l;i<=r;i++)
#define rf(i,r,l) for(long long i=r;i>=l;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }


const int N=1e5+5,mod=1e9+7,bit=61;


signed main()
{
    fast;

    int t=1;
    //cin>>t;
    f(tc,1,t)
    {
        int k;
        cin>>k;
        f(i,1,k)
        {
            cout<<"ACL";
        }
    }
    return 0;
}


Measured memory_bytes: 3544
k = int(input())
if k == 0:
    print(2)
    print(0, 0)
elif k == 1:
    print(3)
    print(1, 0, 3)
elif k < 10 ** 16:
    n = 2
    print(n)
    a = k // n * (n + 1) + n - k - 1#n - k % n
    b = (k // n + 1) * (n + 1) + n - k - 1#k % n
    if k % n == 0:
        print(a, a)
    elif k % n == 1:
        print(a, b)
else:
    n = 50
    print(n)
    a = k // n * (n + 1) + n - k - 1  # n - k % n
    b = (k // n + 1) * (n + 1) + n - k - 1  # k % n
    for i in range(k % n):
        print(b, "", end = "")
    for i in range(n - k % n):
        print(a, "", end = "")

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

map<int,int> team;
int ranking[33];

int main(void){
	while(1){
		int num,score;
		scanf("%d,%d",&num,&score);
		if(num==0) break;
		team[num]=score;
		ranking[score]=1;
	}
	for(int i=30;i>=0;i--) ranking[i]+=ranking[i+1];
	while(1){
		int num;
		cin >> num;
		if(cin.eof()) break;
		printf("%d\n",ranking[team[num]]);
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>


ll func(ll x){
    int n = x%4;
    if(n==0){ return x; }
    if(n==1){ return 1; }
    if(n==2){ return x+1;}
    else{ return 0; }
}

int main(){
    ll A,B; cin>>A>>B;
    ll ans = 0LL;
    int n = 0;
    ll sA = func(A);
    ll sB = func(B);
    cout << (sA^sB^A) << "\n";
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> p(2);
    rep(i, n) {
        if (a[i] % 2)
            p[0]++;
        else
            p[1]++;
    }
    bool flag = false;
    if (p[0] % 2) {
        flag = true;
    }
    if (!flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

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

using namespace std;
#define int long long
int n,a[100005][4],f[100005][4];
main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=3;j++)
		{
			for(int k=1;k<=3;k++)
			{
				if(j!=k) f[i][j]=max(f[i-1][k]+a[i][j],f[i][j]);
			}
		}
	}
	cout<<max(max(f[n][1],f[n][2]),f[n][3]);
}

Measured memory_bytes: 6528
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int dx[]={1,0,-1,0,-1,-1,1,1},dy[]={0,1,0,-1,-1,1,-1,1}; 
const int mod = 1e9+7;
const ll N = 2e5+5;


void solve(){
	int n;
	cin>>n;
	vector<int>a(n);
	rep(i,n)cin>>a[i];
	sort(all(a));
	int mx=a[n-1];
	int ans;
	if(a[n-1]%2==0){
		int x=a[n-1]/2;
		int res=1e9;
		for(int i=0;i<n-1;++i){
			if(res>abs(x-a[i])){
				res=abs(x-a[i]);
				ans=a[i];
			}
		}
	}
	else{
		int x=a[n-1]/2;
		int res=1e9;
		for(int i=0;i<n-1;++i){
			if(res>abs(x-a[i])){
				res=abs(x-a[i]);
				ans=a[i];
			}
		}
		x=a[n-1]/2+1;
		res=1e9;
		for(int i=0;i<n-1;++i){
			if(res>abs(x-a[i])){
				res=abs(x-a[i]);
				ans=a[i];
			}
		}
	}
	cout<<mx<<' '<<ans;

}

int main(){
	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)
		solve();
	return 0;
}

Measured memory_bytes: 3712
#include <cstdlib>
#include<iostream>
#include<stdio.h>
using namespace std;
static const int N_MAX = 1000000;
static const int LEN_P_NAME = 10;

struct Node {
    char name[LEN_P_NAME];
    int time; 
    bool active;
    Node *left;
    Node *right;
};

struct Node *nil = (Node *)malloc(sizeof(Node));
struct Node *QUEUE;
struct Node *LAST_NODE;
int QUEUE_LEN = 0;

int len(Node *queue) {
    if (queue == nil || !queue->active) {
        return 0;
    }
    return QUEUE_LEN;
}

Node* last(Node *queue) {
    return LAST_NODE;
}

Node* head() {
    return QUEUE;
}

Node* tail() {
    return last(QUEUE);
}

Node* create() {
    struct Node *q = (Node *)malloc(sizeof(Node));
    q->left = nil;
    q->right = nil;
    return q;
}

void enqueue(char name[LEN_P_NAME], int time)
{
    Node *q = create();
    
    int l = len(QUEUE);
    QUEUE_LEN++;
    if (l == 0) {
        q = QUEUE;
    }
    
    for (int i = 0; i < LEN_P_NAME; i++) {
        q->name[i] = name[i];
    }
    q->time = time;
    q->active = true;
    
    if (l > 0) {
        Node *last = tail();
        last->right = q;
        q->left = last;
        LAST_NODE = q;
    }
}

void dequeue()
{
    if (len(QUEUE) == 0) {
        return;
    }
    QUEUE_LEN--;
    Node *h = head();
    QUEUE = h->right;
}

void initQueue()
{
    Node *q = create();
    QUEUE = q;
    LAST_NODE = q;
}

int main()
{
    // Scan first line
    int n;
    scanf("%d", &n);
    
    int quantum;
    scanf("%d", &quantum);
    
    // Init queue
    initQueue();
    
    // Scan rows and build queue
    for (int i = 0; i < n; i++) {
        char name[10];
        int time;
        scanf("%s %d", name, &time);
        enqueue(name, time);
    }
    
    // Start Round-Robin
    int l = len(QUEUE);
    int rest = 0;
    int time = 0;
    while(l > 0) {
        Node *h = head();
        rest = h->time - quantum;
        if (rest > 0) {
            // Reschedule
            dequeue();
            enqueue(h->name, rest);
            time += quantum;
            continue;
        }
        
        time += h->time;
        printf("%s %d\n", h->name, time);
        dequeue();

        l = len(QUEUE);
    }
  
    return 0;
}



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


int par[55],dep[55]={};


void init(int n){
  int i;
  for (i=1;i<=n;i++){
    par[i]=i;
    dep[i]=0;
  }
}


int root(int a){
  if (par[a]==a) return a;
  return par[a]=root(par[a]);
}


void unite(int a,int b){
  a=root(a);
  b=root(b);
  if (a==b) return;
  if (dep[a]<dep[b]) par[a]=b;
  else par[b]=a;
}


int main(void){
  int n,m,i,j,a[55],b[55];
  
  cin >> n >> m;
  for (i=0;i<m;i++) cin >> a[i] >> b[i];
  
  int t,ans=0;
  for (i=0;i<m;i++){
    t=-1;
    init(n);
    for (j=0;j<m;j++){
      if (i!=j) unite(a[j],b[j]);
    }
    for (j=1;j<=n;j++){
      if (t==-1){
        t=root(j);
      }else{
        if (t!=root(j)) break;
      }
    }
    if (j!=n+1) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define F first
#define S second
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};

bool app[5001][5001];
int x[3000],y[3000];

int __sign;
int __ch;
inline void S( int &x )
{
x=0;
while((__ch<'0' || __ch>'9')  && __ch!=EOF) __ch=getchar_unlocked();
if (__ch=='-')
__sign=-1 , __ch=getchar_unlocked();
else
__sign=1;
do
x=(x<<3)+(x<<1)+__ch-'0';
while((__ch=getchar_unlocked())>='0' && __ch<='9');
x*=__sign;
}

main(){
  int n;
  while(S(n),n){
    memset(app,0,sizeof(app));
    rep(i,n){
      S(x[i]);
      S(y[i]);
      app[x[i]][y[i]]=1;
    }
    int ans=0;
    rep(i,n){
      rep(j,n){
	int tx=x[i]-x[j],ty=y[i]-y[j];
	if(tx*tx+ty*ty<=ans)continue;
	if(0<=x[i]-ty && x[i]-ty<=5000 &&
	   0<=y[i]+tx && y[i]+tx<=5000 &&
	   app[x[i]-ty][y[i]+tx] &&
	   0<=x[j]-ty && x[j]-ty<=5000 &&
	   0<=y[j]+tx && y[j]+tx<=5000 &&
	   app[x[j]-ty][y[j]+tx])ans=tx*tx+ty*ty;
      }
    }
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 24000
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define black_tree tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define pair_black_tree tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update>
#define gp __gnu_pbds
#define INF 1e18
#define MOD 1000000007
#define MAX 501
#define endl '\n'
#define ll long long
#define ld long double
#define lli long long int
#define ull unsigned long long
#define ulli unsigned long long int
#define pb push_back
#define pf push_front
#define ook order_of_key
#define fbo find_by_order
#define np next_permutation
#define mp make_pair
#define eb emplace_back 
#define mae max_element
#define mie min_element
#define lb lower_bound 
#define ub upper_bound
#define bs binary_search
#define ff first
#define ss second
using namespace std;
using namespace gp;
ll n,x,t;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>x>>t;
	if(n%x==0){
		cout<<n/x*t<<endl;
	}
	else{
		cout<<(n/x+1)*t<<endl;
	}
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k,x;
    cin>>k>>x;
    if(k*500>=x)
    cout<<"Yes";
    else
    cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 2000005
#define mp make_pair
#define pb push_back
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) out(x / 10);
    putchar('0' + x % 10);
}
struct node {
    int id,par;
}sta[MAXN],tmp[MAXN];
int N,M,K,top,cnt,ns[MAXN],nt[MAXN],as[MAXN],at[MAXN];
char s[MAXN],t[MAXN];
void Solve() {
    read(N);read(M);read(K);
    scanf("%s",s + 1);scanf("%s",t + 1);
    reverse(s + 1,s + N + 1);reverse(t + 1,t + M + 1);
    for(int i = 1 ; i <= N ; ++i) ns[i] = s[i] - '0';
    for(int i = 1 ; i <= M ; ++i) nt[i] = t[i] - '0';
    int T = max(N,M);
    for(int i = T ; i >= 1 ; --i) {
	if(ns[i] == 1 && nt[i] == 1) {
	    int op = K,pos = i,x = 3;cnt = 0;
	    while(top) {
		if(x == 3) {
		    if(op >= sta[top].id - pos) {
			op -= sta[top].id - pos;
			pos = sta[top].id;
			tmp[++cnt] = (node){pos,x ^ sta[top].par};
			x = x & sta[top].par;
		    }
		    else break;
		}
		else if(x != 0){
		    if(sta[top].id == pos + 1) {
			pos = sta[top].id;
			if(x ^ sta[top].par) x = 3;
			else x = x & sta[top].par;
		    }
		    else break;
		}
		else break;
		--top;
	    }
	    if(x != 0 && x != 3) {
		++pos;
		tmp[++cnt] = (node){pos,x};
	    }
	    else if(x) {
		pos += op;
		as[pos] = at[pos] = 1;
	    }
	    for(int j = cnt ; j >= 1 ; --j) sta[++top] = tmp[j];
	}
	else {
	    if(ns[i] || nt[i]) {
		sta[++top] = (node){i,ns[i] << 1 | nt[i]};
	    }
	}
    }
    for(int i = 1 ; i <= top ; ++i) {
	as[sta[i].id] = (sta[i].par >> 1) & 1;
	at[sta[i].id] = sta[i].par & 1;
    }
    int c = T + K;
    while(as[c] == 0) --c;
    for(int i = c ; i >= 1 ; --i) {out(as[i]);}
    enter;
    c = T + K;
    while(at[c] == 0) --c;
    for(int i = c ; i >= 1 ; --i) {out(at[i]);}
    enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 40064
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;
const ll mod=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<pll> x(n);
    rep(i,n){
        cin >> x[i].fi >> x[i].se;
    }
    sort(x.begin(),x.end());
    map<pll,ll> m;
    rep(i,n){
        for(ll j=i+1;j<n;j++){
            pll v;
            v.fi=x[j].fi-x[i].fi;
            v.se=x[j].se-x[i].se;
            m[v]++;
        }
    }
    ll cnt=0;
    for(auto x:m){
        cnt=max(cnt,x.se);
    }
    cout << n-cnt << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  string s;
  cin>>s;
  bool ok = true;
  for (int i = 1; i < s.size(); i++) {
    if (s[i - 1] == s[i]) {
        ok = false;
        break;
    } 
  }
  if (ok) cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;
  return 0;
}

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

using ll = long long;
using ld = long double;

const int N = 2e5 + 5;

int n, k, cnt;
int bit[N];
ll ans;
ll pre[N];
vector<ll> ve;
map<ll, int> mp;

void upd(int x, int val) {
  while(x <= n + 1) {
    bit[x] += val;
    x += x & -x;
  }
}

int get(int x) {
  int ret = 0;
  while(x > 0) {
    ret += bit[x];
    x -= x & -x;
  }
  return ret;
}

int get(int x , int y) {
  return get(y) - get(x - 1);
}

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

  cin >> n >> k;
  for(int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    pre[i] = pre[i - 1] + x;
  }
  for(int i = 0; i <= n; i++) {
    pre[i] -= 1LL * i * k;
  }
  for(int i = 0; i <= n; i++) {
    ve.push_back(pre[i]);
  }
  sort(ve.begin(), ve.end());
  ve.resize(unique(ve.begin(), ve.end()) - ve.begin());
  for(auto i : ve) {
    mp[i] = ++cnt;
  }
  for(int i = n; i >= 0; i--) {
    int cur = mp[pre[i]];
    ans += get(cur, cnt);
    upd(cur, 1);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 19680
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> imos(N+1);
  for(int i=0;i<M;i++){
    int L, R;
    cin >> L >> R;
    imos[L-1]++;
    imos[R]--;
  }
  int res = 0;
  for(int i=0;i<N;i++){
    imos[i+1] += imos[i];
    // cout << imos[i] << endl;
    if(imos[i] == M) res++;
  }
  cout << res << endl;
}


Measured memory_bytes: 640
//package abc165.E

import java.io.*
import java.math.*
import java.util.*
import kotlin.math.*

var reader: BufferedReader = System.`in`.bufferedReader()
var writer: PrintWriter = PrintWriter(System.`out`)

fun next() = reader.readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextStrings() = next().split(" ")
fun nextInts() = nextStrings().map { it.toInt() }
fun nextLongs() = nextStrings().map { it.toLong() }
fun nextDoubles() = nextStrings().map { it.toDouble() }

fun put(v: Any?) = writer.print(v)
fun puts() = writer.println()
fun puts(v: Any?) = writer.println(v)

var debug = false
fun dp(v: Any?) {
    if (debug) println(v)
}
fun dp() {
    if (debug) println()
}

fun test(case: Int, input: String, expected: String) {
    reader = input.trimIndent().reader().buffered()

    val stringWriter = StringWriter()
    writer = PrintWriter(stringWriter)

    solve()
    writer.flush()

    val actual = stringWriter.toString()

    println("[test $case]")
    if ("${expected}" == actual) {
        println("OK")
    } else {
        println("NG")
        println()
        println("expected: \"${expected}\"")
        println("actual:   \"${actual}\"")
    }
    println()
}

@Suppress("UNUSED_PARAMETER")
fun xtest(case: Int, input: String, expected: String) {}

fun main(args: Array<String>) {
    if ((args.size == 1) && (args[0] == "test")) {
        testAll()
    } else {
        solve()
        writer.flush()
    }
}

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

fun testAll() {
    debug = true

    test(1,
    """
    4 1
    """,
    """
    2 3
    """.trimIndent()
    )
    test(2,
    """
    7 3
    """,
    """
    1 6
    2 5
    3 4
    """.trimIndent()
    )
    test(3,
    """
    12 5
    """,
    """
    1 6
    2 5
    3 4
    7 11
    8 10
    """.trimIndent()
    )
}

fun solve() {

    val (_, M) = nextInts()

    var l = 1
    var r = l + M
    while (l < r) {
        puts("${l++} ${r--}")
    }

    l = M+2
    r = l + (M-1)
    while (l < r) {
        puts("${l++} ${r--}")
    }
}


Measured memory_bytes: 47884
#include<iostream>
#include<algorithm>
using namespace std;
int main(void){
    int a, b, k;
    cin >> a >> b >> k;
    for(int i=0; i<min(k,b-a+1); i++){
        cout << a+i << endl;
    }
    for(int i=1; i<=k; i++){
        if(a+k-1<b-k+i)cout << b-k+i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// solv_D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <map>

using namespace std;

const int INF = 2002;
//int dist[2001][2001] = { INF, };
map <int, int> distmap;

int main()
{
	int N, X, Y;
	int i, j, k;
	int d,dXY;

	cin >> N >> X >> Y;

	//cout << "N=" << N << " X=" << X << " Y=" << Y << endl;

	for (i = 1; i < N; i++)
		distmap[i] = 0;

	for (i = 1; i < N; i++) {
		for (j = i+1; j < N+1; j++) {
			d = j - i;
			dXY = d;
			if (i <= X) {
				if (j > X) {
					if (j <= Y) {
						dXY = (X - i) + 1 + (Y - j);
					}
					else {
						dXY = (X - i) + 1 + (j - Y);

					}
				}
			}
			else {
				if (j <= Y) {
					dXY = (i - X) + 1 + (Y - j);
				}
				else {
					dXY = (i - X) + 1 + (j - Y);

				}

			}
			if (dXY < d) d = dXY;
			//dist[i][j] = d;
			//cout << "i=" << i << " j=" << j << " d=" << d << endl;

			distmap[d]++;
		}
	}
	for (i = 1; i < N; i++)
		cout << distmap[i] << endl;

}



Measured memory_bytes: 384
d,n = map(int, input().split())

divide = []

if d == 0:
    for i in range(1, 100):
        divide.append(i)    
    divide.append(101)
elif d == 1:
    for i in range(100, 10000, 100):
        divide.append(i)
    divide.append(10100)
    
else:
    for i in range(10000, 1000000, 10000):
        divide.append(i)
    divide.append(1010000)
print(divide[n - 1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7;
const ll LINF=1e18;
using namespace std;
#define int long long

signed main(){
  int h,w,a,b;cin>>h>>w>>a>>b;
  cout<<(h%a)*(w/b)*b+w%b*h<<endl;
}



Measured memory_bytes: 3076