akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main{
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
      	int b = sc.nextInt();
      	int c = sc.nextInt();
      
      int ans =b+c-a;
      if(ans>=0)
        System.out.println(ans);
      else
        System.out.println(0);



		
		
	}
 
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A,B,S;
const ll mo=998244353;

const int NUM_=400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

ll from[2][403][403];
ll to[2][403][403];
ll po[403][403];

ll modpow(ll a, ll n=mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	inv[1]=fact[0]=factr[0]=1;
	for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
	for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	
	FOR(i,401) {
		po[i][0]=1;
		FOR(j,401) po[i][j+1]=po[i][j]*i%mo;
	}
	
	cin>>N;
	from[0][0][0]=1;
	FOR(i,N) {
		cin>>A>>B;
		S+=A;
		memmove(to,from,sizeof(from));
		FOR(j,2) FOR(x,403) FOR(y,403) if(from[j][x][y]) {
			FOR(r,B) {
				(to[j^1][x+A][y+r]+=from[j][x][y]*po[A][r]%mo*factr[r])%=mo;
			}
		}
		swap(from,to);
	}
	
	ll ret=0;
	FOR(j,2) FOR(x,403) FOR(y,403) if(x && from[j][x][y]) {
		ll p=S*modpow(x)%mo*fact[y]%mo*from[j][x][y]%mo*modpow(modpow(x,y))%mo;
		if(j) ret+=p;
		else ret+=mo-p;
	}
	
	cout<<ret%mo<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 16000
using System;
using System.Linq;

namespace _067
{
    class Program
    {
        static void Main(string[] args)
        {
            // B - Snake Toy
            var nk = Console.ReadLine().Split(' ').ToArray();
            var n = int.Parse(nk[0]);
            var k = int.Parse(nk[1]);
            var I = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).OrderByDescending(x=>x).ToArray();

            int sum = 0;
            for (int i = 0; i < k; i++)
            {
                sum += I[i];
            }

            Console.WriteLine(sum);

        }
    }
}


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

int n,a[11000],ans=0;

inline bool cmp(int a,int b)
{
	return a<b;
}

int main()
{
	cin>>n;
	n*=2;
	for(int i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n/2;i++)ans=ans+min(a[i*2-1],a[i*2]);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	void run() {
		in.nextInt();
		in.nextInt();
		String s = in.next();
		String t = in.next();
		long len = lcm(s.length(), t.length());
		for (int i = 0; i < s.length(); i++) {
			long x = i * len / s.length();
			// x == j * len / t.length
			long j = x * t.length();
			if (j % len != 0) {
				continue;
			}
			j /= len;
			if (j < t.length() && t.charAt((int) j) != s.charAt(i)) {
				out.println(-1);
				return;
			}
		}
		out.println(len);
	}

	public static long gcd(long a, long b) {
		while (a > 0) {
			long t = b % a;
			b = a;
			a = t;
		}
		return b;
	}
	
	public static long lcm(long a, long b) {
		return (a / gcd(a, b)) * b;
	}
	
	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		boolean stdStreams = true;
		String fileName = Main.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";
		
		Locale.setDefault(Locale.US);
		BufferedReader br;
		if (stdStreams) {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			br = new BufferedReader(new FileReader(inputFileName));
			out = new PrintWriter(outputFileName);
		}
		in = new MyScanner(br);
		int tests = 1;//in.nextInt();
		for (int test = 0; test < tests; test++) {
			new Main().run();
		}
		br.close();
		out.close();
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(BufferedReader br) {
			this.br = br;
		}
		
		void findToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		
		String next() {
			findToken();
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 25300
//Solution By SlavicG
#include <bits/stdc++.h>
using namespace std;
 
#define ll                          long long
 
#define forn(i,n)                   for(int i=0;i<n;i++)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
	
#define pb                          push_back
#define sz(a)                       (int)a.size()
 
#define   endl                       "\n"
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int  main()
{
	fastio;
	int n;
	cin >> n;
	map<int,int> m;
	ll s = 0;
	int a[n];
	forn(i,n){
		cin >> a[i];
		m[a[i]]++;
		s += a[i];
	}
	int t;
	cin >> t;
	while(t--)
	{
		int a,b;
		cin >> a >> b;
		ll x = m[a];
		s-= x * a;
		s += x * b;
		m[a] -= x;
		m[b] += x;
		cout << s << endl;
	}
}

Measured memory_bytes: 8292
#include "stdio.h"
int main(void){
int H,W;
int i,j;
do{
scanf("%d %d",&H,&W);	
if(H!=0 || W!=0){
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(i==0 || j==0 || i==H-1 || j==W-1){
printf("#");
}else{
printf(".");
}
}
puts("");
}
puts("");
}
}while(H!=0 || W!=0);
return 0;
}

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

using namespace std;

int main()
{
    int n,h;cin>>n>>h;
    int arr[n];
    for(int i=0; i<n;i++)cin>>arr[i];
    int ans[n];
    ans[0]=0,ans[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++){
            ans[i]=1e9;
            for(int j=i-1;j>=max(0,i-h);j--){
            ans[i]=min(ans[i],ans[j]+abs(arr[i]-arr[j]));
            }
    }
    cout<<ans[n-1]<<endl;
}


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

const ll mod = 1e9+7;

int main(){
  ll n, k; cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  
  ll ans1=0;
  rep(j,n)rep(i,j)
    if(a[i]>a[j]) ans1++;
  
  ll ans2=0;
  rep(i,n)rep(j,n)
    if(a[i]>a[j]) ans2++;
  
  ll ans=(((ans1%mod)*(k%mod))%mod + (ans2%mod)*((k*(k-1)/2l)%mod)%mod)%mod;
  
  cout << ans<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=4e3;
int n,a[maxn],d[maxn];
bool vis[maxn],e[maxn][maxn];
vector <int> to[maxn];
struct cp{
	int id,val;
}ccp;
bool operator <(cp x,cp y){return x.val<y.val;}
priority_queue <cp> q;
int gcd(int a,int b){return (b==0)?a:gcd(b,a%b);}
void dfs(int now){
	vis[now]=1;
	for(int i=1;i<=n;i++){if(!vis[i]&&e[now][i]){to[now].push_back(i);d[i]++;dfs(i);}}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){scanf("%d",&a[i]);}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(gcd(a[i],a[j])>1) e[i][j]=true;
		}
	}
	for(int i=1;i<=n;i++){
	    if(!vis[i]){
		    dfs(i);
		    ccp.id=i;ccp.val=a[i];
		    q.push(ccp);
		}
	}
	while(!q.empty()){
		cp s=q.top();q.pop();
		printf("%d ",s.val);
		int siz=to[s.id].size(),u;
		for(int i=0;i<siz;i++){
			u=to[s.id][i];
			d[u]--;
			if(d[u]==0){
				ccp.id=u;ccp.val=a[u];
				q.push(ccp);
			}
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<long long> lun(100001,0);
    queue<long long> sag;
    for(int i=1;i<10;i++){
        lun.at(i)=i;
        sag.push(i);
    }
    int n;
    cin>>n;
    int doko = 10;
    while(doko <= n){
        queue<long long> ts;
        while(!sag.empty() && doko <= n){
            long long tmp=sag.front();
            for(int i=max(0ll, (tmp%10)-1); i<=min(9ll, (tmp%10) +1); i++){
                if(doko <= n){
                    long long tuika = tmp *10 +i;
                    lun.at(doko)=tuika;
                    ts.push(tuika);
                    doko ++;
                }
            }
            sag.pop();
        }
        sag =ts;
    }
    cout<<lun.at(n)<<endl;

}

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

int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(b<=a){
        cout << "delicious" << endl;
    }
    else if(b<=(a+x)){
        cout << "safe"<<endl;
    }
    else{
        cout << "dangerous"<<endl;
    }
    return 0;
}

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

using namespace std;

struct UnionFind{
    vector<int> par;

    UnionFind(int n) : par(n, -1){}

    void init(int n){
        par.assign(n, -1);
    }

    int root(int x){
        if(par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y){
        return root(x) == root(y);
    }

    bool merge(int x, int y){
        x = root(x); y = root(y);
        if(x == y) return false;
        if(par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x){
        return -par[root(x)];
    }
};

int main(){
    long long N, M;
    cin >> N >> M;

    vector<int>A(M), B(M);
    for(int i = 0; i < M; i++){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }

    UnionFind uf(N);
    long long cur = N * (N-1) / 2;
    vector<long long> res;
    for(int i = 0; i < M; i++){
        res.push_back(cur);

        int a = A[M-1-i], b = B[M-1-i];
        if(uf.issame(a, b)) continue;//aとbが同じ連結成分に含まれていたら

        //差分の更新
        long long sa = uf.size(a), sb = uf.size(b);
        cur -= sa * sb;
        uf.merge(a, b);
    }

    reverse(res.begin(), res.end());
    for(int i = 0; i < res.size(); i++) cout << res[i] << endl;

    return 0;
}

Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <tuple>
#include <utility>
#include <stdlib.h>
typedef long long LL;
typedef unsigned long long ULL;
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define pb push_back
#define mp make_pair

int main() {
	LL n, x;
	cin >> n >> x;
	vector<int> l(n);
	rep(i, 0, n) {
		cin >> l[i];
	}
	LL count = 1, sum = 0;
	rep(i, 0, n) {
		sum += l[i];
		if (sum <= x) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}


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

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

template<typename T>
struct CumlativeSum2D {
    int N,M;
    vector<vector<T>> arr;

    CumlativeSum2D (vector<vector<T>> &A) {
        N = A.size();
        A.emplace_back();
        M = A[0].size();
        A.pop_back();
        arr.assign(N+1, vector<T>(M+1,0));
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                arr[i+1][j+1] = A[i][j];
            }
        }
        for (int i = 0; i <= N; i++) {
            for (int j = 0; j < M; j++) {
                arr[i][j+1] += arr[i][j];
            }
        }
        for (int j = 0; j <= M; j++) {
            for (int i = 0; i < N; i++) {
                arr[i+1][j] += arr[i][j];
            }
        }
    }

    //[h1,h2],[w1,w2]
    T get(int h1, int h2, int w1, int w2) {
        if (h1 > h2 || w1 > w2) return 0;
        return arr[h2+1][w2+1] - arr[h2+1][w1] - arr[h1][w2+1] + arr[h1][w1];
    }

    inline const vector<T> &operator[](int k) const {return arr[k+1];}
  	inline vector<T> &operator[](int k) {return arr[k+1];}
};

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

void ABC005D() {
    int N; cin >> N;
    vector<vector<ll>> D(N, vector<ll>(N));
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) cin >> D[i][j];

    CumlativeSum2D<ll> C(D);
    vector<ll> A(N*N+1);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            for (int k = i; k < N; k++) {
                for (int l = j; l < N; l++) {
                    int S = (k-i+1)*(l-j+1);
                    A[S] = max(A[S],C.get(i,k,j,l));
                }
            }
        }
    }
    for (int i = 1; i <= N*N; i++) A[i] = max(A[i],A[i-1]);
    int Q; cin >> Q;
    while (Q--) {
        int a; cin >> a;
        cout << A[a] << endl;
    }
}

void DSL_5_B() {
    int N; cin >> N;
    vector<vector<int>> A(1002, vector<int>(1002));
    for (int i = 0; i < N; i++) {
        int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
        A[x1][y1]++;
        A[x1][y2]--;
        A[x2][y1]--;
        A[x2][y2]++;
    }
    CumlativeSum2D<int> C(A);
    int ans = 0;
    for (int i = 0; i <= 1000; i++) {
        for (int j = 0; j <= 1000; j++) {
            ans = max(ans,C[i][j]);
        }
    }

    cout << ans << endl;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //ABC005D();
    DSL_5_B();
}


Measured memory_bytes: 10768
#include<cstdio>
#include<cstring>
using namespace std;
int a[510][510];
int Abs(int x){
	return x>0?x:-x;
}
int main(){
//	freopen("A.in","r",stdin);
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		{
			if(((i+j)/k)&1)
				a[i][j]+=2;
			if(((m-j+i)/k)&1)
				a[i][j]+=1;
		}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]==0) printf("Y");
			if(a[i][j]==1) printf("G");
			if(a[i][j]==2) printf("B");
			if(a[i][j]==3) printf("R");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 1408
import java.util.*;
public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int arr[] = new int[N];
    for(int i = 0; i<N; i++){
      arr[i] = sc.nextInt(); 
    }
    Arrays.sort(arr);
    int ans = 1000000000;
    for(int i = K-1; i<N; i++){
      ans = Math.min(ans, arr[i] - arr[i-K+1]); 
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 50064
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define uint unsigned int
#define MOD 1000000007
#define MAXN 200005
#define MAXH 4
#define MAXM 100
#define INF 1LL << 60
#define ll long long
#define ull unsigned long long
#define RNG mt19937
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
const int N = 55;

int main(){
	fast_io();
	int n;
	cin >> n;
	int a[n+1] = {};
	int mina = 0,maxa = 0;
	fu(i,1,n){
		cin >> a[i];
		if(a[mina] > a[i])mina = i;
		if(a[maxa] < a[i])maxa = i;
	}
	if(mina == 0)mina = 1;
	if(maxa == 0)maxa = 1; // edge case

	vector<pii> res;
	if(-a[mina] < a[maxa]){
		fu(i,1,n){
			if(a[i] < 0){
				res.pb({maxa,i});
			}
		}
		fu(i,1,n-1){
			res.pb({i,i+1});
		}
	}
	else{
		fu(i,1,n){
			if(a[i] > 0){
				res.pb({mina,i});
			}
		}
		fd(i,n,2){
			res.pb({i,i-1});
		}
	}
	cout << res.size() << '\n';
	for(pii p:res){
		cout << p.F << ' ' << p.S << '\n';
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int v[100][3];
int N;
int init(int n) {
	int index=0;
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= n; j++) {
		    for(int z=0; z<=n;z++)
			if(i+j+z<=n) {
				v[index][0]=i;
				v[index][1]=j;
				v[index][2]=z;
				index++;
			}
		}
	}
	return index;
}
int f(int *a,int n) {
	int sum=0;
	for(int i = 0; i < n; i++) {
		sum=sum*10+a[i];
	}
	return sum;
}
int main() {
	cin>>N;
	if(N<357) {
		cout<<0;
		return 0;
	}
	int count=0;
	string s=to_string(N);
	int len=s.size();
	int a[len];
	len-=3;
	len=init(len);
	for(int i=0; i<len; i++) {
		int index=0;
		a[index++]=3;
		for(int j=0; j<v[i][0]; j++)
			a[index++]=3;
		a[index++]=5;
		for(int j=0; j<v[i][1]; j++)
			a[index++]=5;
		a[index++]=7;
		for(int j=0; j<v[i][2]; j++)
			a[index++]=7;
		do {
			if(f(a,index)<=N)
				count++;
			if(f(a,index)>N)
			break;
		}while(next_permutation(a,a+index)); 
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
f = sorted(list(map(int, input().split())))[::-1]
r = 10**12+1
l = -1
while r - l > 1:
    s = k
    mid = (r + l)//2
    for i, j in zip(a, f):
        if mid < i*j:
            s -= i-mid//j
    if s < 0:
        l = mid
    else:
        r = mid
#    print('r:', r, 'l:', l, 'r-l:', r-l)
print(r)


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

using namespace std;

int no_roads[55];

int main() {
	int n, m, a, b;
	cin >> n >> m;
	while (m--){
		cin >> a >> b;
		++no_roads[a];
		++no_roads[b];
	}
	for (int i = 1; i <= n; ++i)
		cout << no_roads[i] << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  long long l, r, min = 2020;
  scanf("%lld %lld", &l, &r);
  if(r - l >= 2019){
    printf("0\n");
    return 0;
  }
  for(long long i = l; i <= r - 1; i++){
    for(long long j = i + 1; j <= r; j++){
      if((i * j) % 2019 < min){
        min = (i * j) % 2019;
      }
    }
  }
  printf("%d\n", min);
  return 0;
}

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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

void run(void){
  int64 n,m;
  scanf("%lld%lld",&n,&m);
  int64 ans=MIN(n,m/2);
  n-=ans;
  m-=2*ans;
  if(n==0){
    ans+=m/4;
  }
  printf("%lld\n",ans);
}

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

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
  int N;
  int buf;
  int S = 0;
  int i, j, k;
  scanf("%d", &N);
  buf = N;
  for(i = 0; i < 10; i++){
    S += N%10;
    N /= 10;
  }
  N = buf;
  if(N%S == 0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
 
class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		int max=1145148100;
		int now_cost=0;
		int[] point=new int[N];
		int[] ruikei=new int[N];
		ruikei[0]=0;
 
		for(int i=0; i<N; i++) {
			point[i]=sc.nextInt();
		}
 
		for(int i=1; i<N; i++) {
			ruikei[i]=ruikei[i-1]+point[i]-point[i-1];
		}
		for(int i=0; i<N-K+1; i++) {
			now_cost=0;
 
			now_cost=ruikei[K-1+i]-ruikei[i];
 
			if(point[K-1+i]<0) {
				now_cost+=Math.abs(point[K-1+i]);
			}
			else if(point[K-1+i]>=0) {
				if(point[i]>=0) {
					now_cost+=point[i];
				}
				else if(point[i]<0) {
					now_cost+=Math.min(Math.abs(point[i]), point[K-1+i]);
				}
			}
 
			max=Math.min(max, now_cost);
		}
 
		System.out.println(max);
	}
}

Measured memory_bytes: 50048
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }

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

  double n, k;
  cin >> n >> k;
  
  double ans = 1.0 / n;
  double sum = 0.0;
  for(ll i = 1; i <= n; i++){
    double num = i;
    double cnt = 0;
    while(num < k){
      num *= 2;
      cnt++;
    }
    sum += pow(0.5, cnt);
  }
  printf("%.10f\n", sum * ans);
  return 0;
}

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

using namespace std;

static const int N = 100;

int main()
{
	int m[100][100];
	for (int i = 0; i < 100; ++i)
	{
		for (int j = 0; j < 100; ++j)
		{
			m[i][j] = 0;
		}
	}

	int n; cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int u, d;
		cin >> u >> d;
		for (int i = 0; i < d; ++i)
		{
			int v; cin >> v;
			m[u - 1][v - 1] = 1;
		}
	}

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			cout << m[i][j];
			if (j != n - 1) cout << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3148
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 1005
#define M 200005
#define seed 23333
#define Mo 1000000007

using namespace std;
int i,j,m,n,p,k,f[N][N*2],dis[N],fa[N],Q[N],x,y,dia[N],ans,D,col[N],Dis[N],lim[N];
vector<int>v[N];
void jia(int &x,int y)
{
		x+=y; if (x>=Mo) x-=Mo;
}
void jian(int &x,int y)
{
		x-=y; if (x<0) x+=Mo;
}
int bfs(int *dis,int x)
{
		memset(fa,0,sizeof(fa));
		for (i=1;i<=n;++i) dis[i]=-1;
		dis[x]=0; Q[Q[0]=1]=x;
		int i,l;
		for (l=1;l<=Q[0];++l)
		{
				int p=Q[l];
				for (i=0;i<(int)v[p].size();++i)
				{
						int k=v[p][i];
						if (dis[k]!=-1) continue;
						dis[k]=dis[p]+1;
						fa[k]=p;
						Q[++Q[0]]=k;
				}
		}
		int now=1;
		for (i=1;i<=n;++i) if (dis[now]<dis[i]) now=i;
		return now;
}
void dfs(int x)
{
	  int i,j;
	  for (i=-n+N;i<=n+N;++i) if (abs(i-N)<=D/2-dis[x]) f[x][i]=1; 
	  for (i=0;i<(int)v[x].size();++i)
	  {
	  		int p=v[x][i];
	  		if (fa[x]==p) continue;
	  		dfs(p);
	  		for (j=-n+N;j<=n+N;++j) 
				f[x][j]=1ll*f[x][j]*(f[p][j-1]+f[p][j+1])%Mo;
	  }
}
void Dfs(int x,int tp)
{
	  int i,j;
	  for (i=-n+N;i<=n+N;++i) 
	  	if (col[x])
	  {
	  		if (abs(i-N)<=lim[x]) f[x][i]=1;
	  }
	  else if (abs(i-N-tp)<=lim[x]) f[x][i]=1;
	  for (i=0;i<(int)v[x].size();++i)
	  {
	  		int p=v[x][i];
	  		if (fa[x]==p) continue;
	  		Dfs(p,tp);
	  		for (j=-n+N;j<=n+N;++j) 
				f[x][j]=1ll*f[x][j]*(f[p][j-1]+f[p][j+1])%Mo;
	  }
}
int main()
{
		scanf("%d",&n);
		for (i=1;i<n;++i)
		{
				scanf("%d%d",&x,&y);
				v[x].pb(y); v[y].pb(x); 
		}
		int x=bfs(dis,1),y=bfs(dis,x);
		for (;y;y=fa[y]) dia[++dia[0]]=y;
		if (dia[0]&1)
		{
			 D=dia[0]-1;
			 bfs(dis,dia[D/2+1]);
			 dfs(dia[D/2+1]);
			 for (i=-n+N;i<=n+N;++i) jia(ans,f[dia[D/2+1]][i]);
			 printf("%d\n",ans); 
		}
		else
		{
			D=dia[0]-1;
			bfs(Dis,dia[D/2+2]);
			bfs(dis,dia[D/2+1]);
			for (i=1;i<=n;++i) if (dis[i]<Dis[i]) col[i]=1; 
			for (i=1;i<=n;++i)
				if (col[i]) lim[i]=D/2+1-dis[i];
				else lim[i]=D/2-Dis[i];
			Dfs(dia[D/2+1],0);
			for (i=-n+N;i<=n+N;++i) jia(ans,f[dia[D/2+1]][i]);
			for (i=1;i<=n;++i) 
				if (col[i]) lim[i]=D/2-dis[i];
				else lim[i]=D/2+1-Dis[i];
			memset(f,0,sizeof(f));
			Dfs(dia[D/2+1],0);
			for (i=-n+N;i<=n+N;++i) jia(ans,f[dia[D/2+1]][i]);
			for (i=1;i<=n;++i) 
				if (col[i]) lim[i]=D/2-dis[i];
				else lim[i]=D/2-Dis[i];
			memset(f,0,sizeof(f));
			Dfs(dia[D/2+1],-1);
			for (i=-n+N;i<=n+N;++i) jian(ans,f[dia[D/2+1]][i]);
			memset(f,0,sizeof(f));
			Dfs(dia[D/2+1],1);
			for (i=-n+N;i<=n+N;++i) jian(ans,f[dia[D/2+1]][i]);
			printf("%d\n",ans); 
		}
}


Measured memory_bytes: 8192
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-9;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
long long p[110000];
int main(){
	int a;scanf("%d",&a);
	int sz=0;
	for(int i=-200;i<=200;i++){
		p[sz++]=(long long)i*i*i*i*i;
	}
	for(int i=0;i<sz;i++)for(int j=0;j<sz;j++){
		if(p[i]-p[j]==a){
			printf("%d %d\n",i-200,j-200);return 0;
		}
	}
}

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

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int k;
    string s;
    cin>>k>>s;
    if(s.length()>k)
        cout<<s.substr(0,k)<<"..."<<endl;
    else 
        cout<<s<<endl;
    return 0;
}


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

typedef pair<int,int> P;

int main(){
  P m[100];
  int n,a,b,c,d;
  int p[100],r[100];

  cin >> n;
  for(int i=0;i<n;i++)p[i] = 0;
  int N = n*(n-1)/2;
  for(int i=0;i<N;i++){
    cin >> a >> b >> c >>d;
    a--;b--;
    if(c>d)p[a] += 3;
    else if(c<d)p[b] += 3;
    else {
      p[a]++; p[b]++;
    }
  }

  for(int i=0;i<n;i++)m[i] = P(p[i],i);

  sort(m,m+n,greater<P>());

  r[m[0].second] = 1;
  for(int i=1;i<n;i++){
    if(m[i-1].first == m[i].first)r[m[i].second] = r[m[i-1].second];
    else r[m[i].second] = i+1;
  }

  for(int i=0;i<n;i++)cout << r[i] << endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ull unsigned long long 
#define int long long
#define pb push_back 
#define mp make_pair
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define MAX 1e18
#define PI 3.14159265
const int mod = 1e9 + 7;
#define ordered_set tree<pair<int, int>, null_type,less<pair<int, int>>, rb_tree_tag,tree_order_statistics_node_update>






 
int power(int x, int y) 
{ 
   int res = 1;      
                                                              
   
    while (y > 0) 
    { 
       
        if (y & 1) 
            res = (long long)(res*x); 
  
 
        y = y>>1; 
 
        if (x<=100000000)
        x = (long long)(x*x);
 
        //cout<<x<<'\n'; 
    } 
    return res; 
} 
 
int gcd (int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd (b, a % b);
}

int ceiling(int a,int b){
  if(a%b!=0){
    return (a/b)+1;

  }
  else
    return (a/b);
}
 

 void solve()
 {
  int l,r,d;
  cin>>l>>r>>d;
  int count=0;
  for(int i=l;i<=r;i++){
    if(i%d==0)
      count++;
  }
  cout<<count<<endl;
return;
}



 
 int32_t main()
 {
  IOS;
  int t;
  t=1;
  while(t--){
    solve();
  }

    return 0;
 }


Measured memory_bytes: 3616
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[30] CNT;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    foreach (_; 0..N) {
        auto as = readln.split.to!(int[]);
        foreach (n; as[1..$]) {
            ++CNT[n-1];
        }
    }

    int cnt;
    foreach (c; CNT) if (c == N) ++cnt;

    writeln(cnt);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;
const int maxi=3005;
int dp[maxi][maxi];
signed main() {

	fastio();
//	#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	string s;
	cin>>s;
	dp[1][1]=1;
	vector<int> pref(n+1,0);
	pref[1]=1;
	for(int len=2;len<=n;len++)
	{
		
		for(int b=1;b<=len;b++)
		{
			int l,r;
			if(s[len-2]=='>')
			{
				l=b,r=len-1;
			}else{
				l=1,r=b-1;
			}
			if(l>r)
				continue;
			dp[len][b]+=((pref[r]-pref[l-1]+MOD)%MOD);
			dp[len][b]%=MOD;
		//	cout<<dp[len][b]<<endl;
		}
		//	cout<<"HH"<<endl;
		for(int i=1;i<=n;i++)
		{
			pref[i]=dp[len][i];
			pref[i]+=pref[i-1];
			pref[i]%=MOD;
		}
	}

	int ans=0;
	for(int i=1;i<=n;i++)
	{
		ans+=dp[n][i];
		ans%=MOD;
	}
	cout<<ans;
	return 0;
 
 }

Measured memory_bytes: 69120
X,N = map(int,input().split())
p = list(map(int, input().split()))
n =max(X+1,N+1)

for i in range(n):
  if X-i not in p:
    print(X-i)
    break
  elif X+i not in p:
    print(X+i)
    break
  else:
    continue

Measured memory_bytes: 9184
s=input()
#s = ("2020 2040")
#print(s) 
s = s.split(" ")
 
L = int( s[0] )
R = int( s[1] )
 
 
result =4.0e9  
for i in range(L,min(L+2019,R)):
    for j in range(i+1,min(R+1,L+2020)):
        mod = i*j % 2019
        #print(i,j,i*j,mod)
        if result > mod:
            result = mod
 
print(result)

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

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(),(a).rend())
#define ll long long
#define pb(a) push_back(a)

#define PRINTV(v) {for(ll deB=0; deB<(v).size(); deB++){cout << (v)[deB] << " ";}cout << endl;}

ll pf(ll n){
	if(n==1) return 1;
	if(n%2==0) return 2;
	for(ll i=3; i*i<=n; i+=2){
		if(n%i==0) return i;
	}
	return n;
}

int main(){
	ll N,P;
	cin >> N >> P;
	
	ll ret = 1;
	
	vector<ll> v;
	
	ll t = P;
	while(t!=1){
		ll p=pf(t);
		//cout << p << endl;
		v.pb(p);
		t/=p;
	}
	
	t=1;
	ll len=0;
	REP(i,v.size()){
		if(t==v[i]) len++;
		else {t=v[i]; len=1;}
		if(len==N) {ret*=t; len=0;};
	}
	
	cout << ret << endl;

	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  char ac,bc;
  ac=char('0'+a);bc=char('0'+b);
  string s1,s2;
  s1=string(b,ac);
  s2=string(a,bc);
  if(s1<s2)cout<<s1<<endl;
  else cout<<s2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

    if (S == string("ABC"))
    {
        cout << "ARC" << endl;
    }
    else {
        cout << "ABC" << endl;
    }
    return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll n;
  cin >> n;
  string s;
  map<string, int> mps;
  for(int i = 0; i < n; ++i)
  {
    cin >> s;
    mps[s]++;
  }
  ll m;
  cin >> m;
  string t;
  map<string, int> mpt;
  for(int i = 0; i < m; ++i)
  {
    cin >> t;
    mpt[t]++;
  }

  int ans = 0;
  for(const auto& m : mps)
  {
    ans = max(ans, mps[m.first] - mpt[m.first]);
  }
  cout << ans;


}

int main()
{
  fastio;
  solve();

  return 0;
}

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

int main(){
    long long n;
    cin >> n;
    long long a[n];
    for(long long i=0;i<n;i++) cin >> a[i];
    long long l[n+1];
    l[0]=0;
    for(long long i=1;i<=n;i++){
        l[i]=__gcd(l[i-1],a[i-1]);
    }
    long long r[n+2];
    r[n+1]=0;
    for(long long i=n;i>0;i--){
        r[i]=__gcd(r[i+1],a[i-1]);
    }
    long long m[n+1];
    long long ans=0;
    for(long long i=1;i<=n;i++){
        m[i]=__gcd(l[i-1],r[i+1]);
        ans=max(ans,m[i]);
    }
    cout << ans << endl;
}


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

int main()
{
    long long S;
    cin >> S;

    // long long l = 0;
    // long long r = 1000000000;
    // while (r - l > 1)
    // {
    //     long long center = (r + l) / 2;
    //     if (center * center < S)
    //     {
    //         l = center;
    //     }
    //     else
    //     {
    //         r = center;
    //     }
    // }
    // long long a = r;
    // long long b = r;
    // long long cd = -(S - r * r);
    // long long c = 0;
    // long long d = 0;
    // for (long long i = 1; i * i <= cd; i++)
    // {
    //     if (cd % i == 0)
    //     {
    //         c = i;
    //         d = cd / i;
    //     }
    // }

    // cout << cd << endl;

    long long a = 1000000000;
    long long l = 0;
    long long r = 1000000000;
    while (r - l > 1)
    {
        long long center = (r + l) / 2;
        if (a * center < S)
        {
            l = center;
        }
        else
        {
            r = center;
        }
    }
    long long b = r;
    long long c = 1;
    long long d = -(S - a * b);

    cout << 0 << " ";
    cout << 0 << " ";
    cout << a << " ";
    cout << d << " ";
    cout << c << " ";
    cout << b << endl;
}


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

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	ll ans = 0;
	ll pos = 0;
	ll tmp = 0;
	for (int i = 0; i < n; i++) {
		ans += a.at(pos);
		tmp++;
		if (tmp == 2) {
			pos++;
			tmp = 0;
		}
	}
	ans -= a.at(0);
	cout << ans << endl;
}

Measured memory_bytes: 4048
#include <cstdio>

const int maxn = 233, mod = 998244353;

int n, ans, x[maxn], y[maxn], pw2[maxn];

int main() {
	scanf("%d", &n);
	pw2[0] = 1;
	for (int i = 1; i <= n; ++i) {
		pw2[i] = (pw2[i - 1] << 1) % mod;
	}
	for (int i = 0; i < n; ++i) {
		scanf("%d%d", x + i, y + i);
		for (int j = 0; j < i; ++j) {
			int m = 0;
			for (int k = 0; k < j; ++k) {
				if((x[j] - x[k]) * (y[i] - y[k]) == (x[i] - x[k]) * (y[j] - y[k])) {
					++m;
				}
			}
			ans = (ans + pw2[m]) % mod;
		}
	}
	printf("%d\n", (pw2[n] - ans - n - 1 + mod) % mod);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

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

    int k = 0, score = 0;
    while (score < n) {
        k++;
        score += k;
    }

    for (int i = 1; i <= k; i++) {
        if (i == score - n) continue;
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3624
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef vector<pii>vip;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 200005;
 
void task(){
 	string a,b; cin >> a >> b;

 	sort(all(a));
 	sort(all(b));
 	reverse(all(b));

 	if(a<b) cout << "Yes" << endl;
 	else cout <<"No" << endl;
}

int main(){
        _
        #ifdef OJ
        freopen("inputf.in", "r", stdin);
        freopen("outputf.in", "w", stdout);
        #endif

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




Measured memory_bytes: 3664
#include<stdio.h>
#include<math.h>
struct point {
    double x, y;
};
void koch(int n, struct point a, struct point b) {
    if ( n == 0) return;
    struct point s, t, u;
    double rad = 3.1415926535897932384626 / 3;
    s.x = ( 2 * a.x + b.x ) / 3;
    s.y = ( 2 * a.y + b.y ) / 3;
    t.x = ( a.x + 2 * b.x ) / 3;
    t.y = ( a.y + 2 * b.y ) / 3;
    u.x = ( t.x - s.x ) * cos(rad) - ( t.y - s.y ) * sin(rad) + s.x;
    u.y = ( t.x - s.x ) * sin(rad) + ( t.y - s.y ) * cos(rad) + s.y;
 
    koch(n - 1, a, s);
    if ( s.x < 0 ) s.x *= -1;
    if ( s.y < 0 ) s.y *= -1;
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    if ( u.x < 0 ) u.x *= -1;
    if ( u.y < 0 ) u.y *= -1;
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    if ( t.x < 0 ) t.x *= -1;
    if ( t.y < 0 ) t.y *= -1;
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}
 
int main(void) {
    struct point p, q;
    int n;
    scanf("%d", &n);
    p.x = 0;
    p.y = 0;
    q.x = 100;
    q.y = 0;
    printf("%.8f %.8f\n", p.x, p.y);
    koch(n, p, q);
    printf("%.8f %.8f\n", q.x, q.y);
 
    return 0;
}

Measured memory_bytes: 1784
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
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; }

struct UnionFind {
	vector<int> parent;
	int size;
	UnionFind(int n) :parent(n, -1), size(n) {}
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y)return false;
		if (sizeOf(x) < sizeOf(y))swap(x, y);
		parent[x] += parent[y]; parent[y] = x; size--;
		return true;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
	int sizeOf(int x) { return -parent[root(x)]; }
};


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	UnionFind uf(N + M);
	rep(i, 0, N) {
		int k; cin >> k;
		rep(j, 0, k) {
			int l; cin >> l; l--;
			uf.unite(i, N + l);
		}
	}
	rep(i, 0, N - 1) {
		if (!uf.same(i, i + 1)) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <set>
#include <list>
#include <deque>
#include <map>
#include <queue>
#include <fstream>
#include <cassert>
#include <cmath>
#include <sstream>
#include <time.h>
#include <complex>
#include <iomanip>
//#include <unordered_set>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef pair<char,char> cc;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l4;
const double eps = 0.005;
const int maxn = 1010;
const ll mod = 1e9+7;
const int INF = 1e9;
const double pi = acos(-1);
typedef double Matrix[maxn][maxn];
int n;
int M[maxn][maxn];
int H,W,h,w;
int main() {
    scanf("%d%d%d%d",&H,&W,&h,&w);
    if (H%h == 0 && W%w == 0) {
        printf("No");
        return 0;
    }
    printf("Yes\n");
    bool sp = 0;
    if (H%h == 0) {
        sp = 1;
        swap(H, W);
        swap(h, w);
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i%h == 0) {
                M[i][j] = 1000*(h-1)-1;
            } else {
                M[i][j] = -1000;
            }
        }
    }
    if (!sp) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                printf("%d ",M[i][j]);
            }
            printf("\n");
        }
    } else {
        for (int i = 0; i < W; i++) {
            for (int j = 0; j < H; j++) {
                printf("%d ",M[j][i]);
            }
            printf("\n");
        }
    }
    return 0;
}






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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int sum = 0;
  rep(_, 3) {
    int a;
    cin >> a;
    sum += a;
  }
  if (sum >= 22) {
    cout << "bust";
  } else {
    cout << "win";
  }
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


auto main() -> int
{
    int n;
    cin >> n;
    cout << "ABC" << n << endl;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#define N 100000

int main(){
  int n,i,m,a,cnt=0;
  int num[N];
  int l,mid,r;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&num[i]);
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&a);
    r=n;
    l=0;
    while(l<r){
      mid=(l+r)/2;
      if(a==num[mid]){
	cnt++;
	break;
      }
      if(a>num[mid])l=mid+1;
      else if(a<num[mid])r=mid;
    }
  }
    printf("%d\n",cnt);
    return 0;
  }
      
    



Measured memory_bytes: 2244
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,ans;
int main()
{
	scanf("%d%d",&n,&k);
	while(n--) {
		int x; scanf("%d",&x);
		ans += min(x,k-x) * 2;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
import collections
N = int(input())
a = list(map(int, input().split()))
if N == 1:
    print(1)
    exit()
if N == 2:
    if abs(a[0]-a[1]) <= 2:
        print(2)
    else:
        print(1)
    exit()
c = collections.Counter(a)
c_key = list(c.keys())
c_value = list(c.values())
res = 0
if len(c) == 2:
    if int(c_key[1])-int(c_key[0]) <= 2:
        print(c_value[0]+c_value[1])
        exit()
for i in range(1,len(c)-1):
    temp = c_value[i]
    temp_2 = 0
    temp_3 = 0
    flag = True
    if int(c_key[i])-int(c_key[i-1]) == 1:
        temp += c_value[i-1]
        flag = False
    if int(c_key[i+1])-int(c_key[i]) == 1:
        temp += c_value[i+1]
        flag = False
    if flag and int(c_key[i+1])-int(c_key[i]) == 2:
        temp_2 = c_value[i+1]+c_value[i]
        flag = False
    if flag and int(c_key[i])-int(c_key[i-1]) == 2:
        temp_3 = c_value[i-1]+c_value[i]
    if max(temp,temp_2,temp_3) > res:
        res = max(temp,temp_2,temp_3)
print(max(res,c_value[0],c_value[-1]))

Measured memory_bytes: 58476
n = int(input())
s = input()
cnt = [0, 0]
add = [0, 0]
ans = ''
for i in range(n):
    if s[i] == ')':
        cnt[0] += 1
        if cnt[0] > cnt[1]:
            add[1] += 1
            cnt[1] += 1
    else:
        cnt[1] += 1

print('(' * add[1] + s + ')'*(cnt[1] -cnt[0]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#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(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

void dfs(string s, char mc, int n)
{
	if(s.size() == n) cout << s << '\n';
	else{
		for(char c='a'; c<=mc; c++){
			dfs(s+c, (c==mc ? mc+1 : mc), n);
		}
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	dfs("", 'a', n);
	return 0;
}



Measured memory_bytes: 1536
#include<stdio.h>

int main(void){
   int x,y,i,j;
   for(;;){
      scanf("%d %d",&y,&x);
      if(x+y==0) break;
      for(i=0;i<y;i++){
         for(j=0;j<x;j++)
            printf("#");
         printf("\n");
      }
   printf("\n");
   }
   return 0;
}

Measured memory_bytes: 572