akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define foru(i, a, n) for (int i=(a); i<=(n); i++)
#define ford(i, n, a) for (int i=(n); i>=(a); i--)
#define rep(i, n) for(int i=0; i<n; i++)
#define foreach(it, a) for (auto it = (a).begin(); it != (a).end(); it++)
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define all(x) (x).begin(),(x).end()
#define ms(s, n) memset(s, n, sizeof(s))
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define fi first
#define se second
#define bit(n, i) (((n) >> (i)) & 1)
#define bit1cnt(x) (__builtin_popcountll(x))
#define bit0dau(x) (__builtin_clzll(x))
#define bit0cuoi(x) (__builtin_ctzll(x))
#define sqr(x) ((x) * (x))
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> LL;
typedef vector<int> vi;
typedef vector<ii> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = 1007681537;
const int inf = (int) 1e9;
const ll linf = (ll) 1e18;
const ld pi = acos((ld) -1);
const ld eps = 1e-9;
const int N = 555;
int m, n, a[N][N];
vii fro, sto;

int main() {
    //freopen("a.in", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    ms(a, 0);
    cin >> m >> n;
    foru(i, 1, m) foru(j, 1, n) cin >> a[i][j];
    /* solution
	- Chuyen dan tat ca cac o [i,j] xuong hang duoi cung: de o [i,j] la so chan
	- o hang cuoi cung: chuyen het tu dau hang ve cuoi hang
    */
    foru(i,1,m-1) foru(j,1,n)if(a[i][j] % 2 != 0){
    	a[i+1][j]++;
    	fro.pb(ii(i,j));
    	sto.pb(ii(i+1,j));
    }
    foru(j,1,n-1) if(a[m][j] % 2 == 1){
    	a[m][j+1]++;
    	fro.pb(ii(m,j));
    	sto.pb(ii(m,j+1));
    }
    cout <<fro.size() <<"\n";
    for(int i=0; i<fro.size(); i++) cout <<fro[i].fi <<" " <<fro[i].se <<" " <<sto[i].fi <<" " <<sto[i].se <<"\n";
    return 0;
}


Measured memory_bytes: 5484
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vvi a;

int main(){
	cin>>n;
	for(ll k=1;k<100000;k++) if(k*(k-1)/2==n){
		cout<<"Yes"<<endl;
		cout<<k<<endl;
		a=vvi(k);
		int t=1;
		for(int i=0;i<k;i++) for(int j=i+1;j<k;j++){
			a[i].push_back(t);
			a[j].push_back(t);
			t++;
		}
		for(int i=0;i<k;i++){
			int N=a[i].size();
			cout<<N;
			for(int j=0;j<N;j++) cout<<' '<<a[i][j];
			cout<<endl;
		}
		return 0;
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 2304
#include<cstdio>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main(){
    int price,change;
    int money[6]={500, 100, 50, 10, 5, 1};
    while(1){
    int cnt=0;
    cin >> price;
    if(price == 0)break;
    change = 1000 - price;
    for(int i = 0;i < 6;i++){
        while(1){
            if(change >= money[i]){
                change -= money[i];
                cnt++;
            }
            else break;
        }
    }
    cout << cnt << endl;
    }
    return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  cout << n/3 << endl;

  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
ll mod = 1e9+7;


int main(){
    int k;
    cin >> k;
    string s;
    cin >> s;
    string t;
    if(s.size()<=k) cout << s << endl;
    else if(s.size()>k){
        rep(i,k) t.push_back(s[i]);
        rep(i,3) t.push_back('.');
        cout << t << endl;
    }
    return 0;
}

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

#define LEN 100005


typedef struct pp {
	char name[100];
	int t;
} P;

P Q[LEN+1];
int head, tail, n;

void initialize(){
    head = 0;
	tail = 0;
}

int  isEmpty(){
	if (head == tail) return 1;
	else return 0;
}

int  isFull(){
	if( head == (tail + 1) % (LEN+1)) return 1;
	else return 0;
}



void enqueue(char *s, int t) {

	if (isFull()==1){
		printf("エラー（オーバーフロー）");
		exit(0);
	}
	strcpy(Q[tail].name,s);
	Q[tail].t = t;
	if (tail + 1 == (LEN+1))
	     tail = 0;
	else
		tail++;
}

P dequeue() {

	P x;
	
	if (isEmpty()==1){
		printf("エラー（アンダーフロー））");
		exit(0);
	}
	
	x = Q[head];
	
	if (head+1 == LEN+1) {
		head = 0;
	}
	else head++;
	
	return x;

}

int main(void) {
	
	initialize();
	
	int elaps = 0;
	int i, q;
	scanf("%d %d", &n, &q);
	P u;
	
	head = 1;
	tail = n+1;
	
	for ( i = 1; i <= n; i++) {
		scanf("%s", Q[i].name);
		scanf("%d", &Q[i].t);
	}

	
	while(head != tail){
	
		if(Q[head].t > q){
			Q[head].t = Q[head].t - q;
			u = dequeue();
			enqueue(u.name,u.t);
			elaps = elaps+q;
		} 
		else{
			u = dequeue();
			elaps = elaps+u.t;
			printf("%s %d\n",u.name,elaps);
		}
	
	}
	
	return 0;
}



Measured memory_bytes: 11964
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int K = scan.nextInt();
        int[] dp = new int[N];
        for (int i = 0; i < N; i++) {
            dp[i] = scan.nextInt();
        }
        for (int t = 0; t < K; t++) {
            int[] diff = new int[N];
            for (int i = 0; i < N; i++) {
                diff[Math.max(0, i - dp[i])] += 1;
                if (i + dp[i] + 1< N) {
                    diff[i + dp[i] + 1] += -1;
                }
            }
            int[] next_dp = new int[N];
            next_dp[0] = diff[0];
            boolean found = false;
            for (int i = 1; i < N; i++) {
                next_dp[i] = next_dp[i-1] + diff[i];
                if (next_dp[i] < N) {
                    found = true;
                }
            }
            dp = next_dp;
            if (!found) {
                break;
            }
        }
        System.out.println(Arrays.stream(dp).mapToObj(i -> Integer.toString(i)).collect(Collectors.joining(" ")));
    }
}


Measured memory_bytes: 70084
x, a, b = input().split()
x = int(x)
a = int(a)
b = int(b)
# print("x =", x)
# print("a =", a)
# print("b =", b)

if x < a:
    distance_xa = a - x
else:
    distance_xa = x - a
# print("distance_xa =", distance_xa)

if x < b:
    distance_xb = b - x
else:
    distance_xb = x - b
# print("distance_xb =", distance_xb)

if distance_xa < distance_xb:
    print("A")
else:
    print("B")


Measured memory_bytes: 3060
import numpy as np
    
N  = int(input())
    
AB = []
time = 0
    
for _ in range(N):
    AB.append(list(map(int, input().split())))
    
AB = np.array(AB)
    
sorted_AB = AB[AB[:,1].argsort(), :]
    
for i in range(N):
    time += sorted_AB[i,0]
    
    if time > sorted_AB[i,1]:
        print('No')
        exit()
    
print('Yes')

Measured memory_bytes: 62476
#include <stdio.h>
int main(){
int a, b, c, h, w;

	while(1){
	scanf("%d %d", &h, &w);
		if(h >= 300 && w >= 300) break;
		if(h == 0 && w == 0) break;
		for(a = 0; a < h ; a++){
			for(b = 0 ; b < w ; b++){
					if((a + b)%2==1){
						printf(".");
					}else{
						printf("#");
					}
				}
			printf("\n");
			}
			printf("\n");
	
	}
	
	return 0;

}

Measured memory_bytes: 572
#include<cstdio>
#include<cmath>
int main()
{
	int n,f;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){	
		f=0;	
		for(int a=-sqrt(2*i);a<=sqrt(2*i);a++){
			for(int b=-sqrt(2*i);b<=sqrt(2*i);b++){
				if((int)sqrt(2*i-a*a-b*b)==sqrt(2*i-a*a-b*b)){
					int c=sqrt(2*i-a*a-b*b);
					if(a-b+c>=2&&a+b-c>=2&&b+c-a>=2)
						f++;					
				}

			}
		}
		printf("%d\n",f);		
	} 
	return 0;
}

Measured memory_bytes: 2216
#include <stdio.h>

int max(int a,int b){
	if(a>=b){return a;}
	else{return b;}
}

int main() {

	int A,B;

	scanf("%d %d",&A,&B);

	printf("%d\n",max(max(A+B,A-B),A*B));

	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int b = sc.nextInt();

		int out = n*m > b ? b : n*m;
		System.out.println(out);



	}

}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

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

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

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

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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

int main() {
  char b;
  cin >> b;
  
  if ( b == 'A' ) {
  	cout << 'T' << endl; 
  }
  else if ( b == 'G' ) {
   cout << 'C' << endl;
  }
  else if ( b == 'T' ) {
   cout << 'A' << endl;
  }
  else {
    cout << 'G' << endl;
	}
}  
  
  

Measured memory_bytes: 256
s = input()
k = 0
ans = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "G" or s[i] == "C" or s[i] == "T":
        k += 1
    else:
        ans = max(ans, k)
        k = 0

ans = max(ans, k)
print(ans)

Measured memory_bytes: 3060
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
const long long Mod=1e9+7;
int n;
long long f[55][110],c[55][55];
int main()
{
	scanf("%d",&n);
	for (int i=0;i<=n;i++)
	{
		c[i][0]=1;
		for (int j=1;j<=i;j++)
		{
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%Mod;
		}
	}
	f[1][n]=f[1][n-1]=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=-i;j<=i;j++)
		{
			for (int a=0;a<n;a++)
			{
				for (int b=0;b<n;b++)
				{
					if (a+b==0 || a+b+i>n || (a+b+j)&1 || abs(j)>a+b)
					{
						continue;
					}
					f[i+a+b][(j+a-b)/2+n]=(f[i+a+b][(j+a-b)/2+n]+c[a+b+i][a+b]*c[a+b][a]%Mod*f[i][j+n]%Mod)%Mod;
				}
			}
		}
	}
	printf("%lld\n",f[n][n]);
    return 0;
}
//曾经沧海难为水，除却巫山不是云。
//——元稹《离思》

Measured memory_bytes: 256
io = STDIN
n,m=io.gets.split.map(&:to_i)
ar=n.times.map{io.gets.split.map(&:to_i)}
tot=0
ar.sort_by{|a,b|a}.each do|a,b|
  if m>b
    tot+=a*b
    m-=b
  else
    tot+=a*m
    m=0
  end
  break if m<=0
end
puts tot

Measured memory_bytes: 12536
import java.util.Scanner;;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int x = scan.nextInt();
		int ans = 1;
		for(int i = 0; i < 3; i++) {
			ans = ans * x;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 26336
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	string S;
	cin >> S;

	int N = S.size();
	vector<int> V;
	V.pb(N);
	int kazu = 0;
	int A[26] = {};
	for (int i = N - 1; i >= 0; i--) {
		A[S[i] - 'a']++;
		int OK = 0;
		rep(j, 26) if (!A[j]) OK = 1;
		if (!OK) {
			kazu++;
			V.pb(i);
			rep(j, 26) A[j] = 0;
		}
	}

	rep(j, 26) A[j] = 0;
	vector<char> kotae;
	int flag = 0;
	int nai = 0;
	rep(i, N) {
		if (i == V[kazu]) {
			rep(j, 26) if (!A[j]) {
				nai = j;
				break;
			}
			kotae.pb('a' + nai);
			kazu--;
			flag = 1;
		}
		if (flag && S[i] == 'a' + nai) {
			rep(j, 26) A[j] = 0;
			flag = 0;
		}
		else if (flag == 0) {
			A[S[i] - 'a']++;
		}
	}
	rep(j, 26) if (!A[j]) {
		nai = j;
		break;
	}
	kotae.pb('a' + nai);

	rep(i, kotae.size()) cout << kotae[i];
	cout << endl;

	Would you please return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int s, w; cin >> s >> w;
	cout << (s <= w ? "unsafe" : "safe") << '\n';
	return 0;
}

Measured memory_bytes: 3624
function rec(a, b) {
	if (a[0] > b[0]) {return 'GREATER';}
	else if (a[0] < b[0]) {return 'LESS';}
	else if (a.length == 1) {return 'EQUAL'}
	else {return rec(a.slice(1), b.slice(1));}
}

function main(s) {
	s = s.split('\n');
	if (s[0].length > s[1].length) {console.log('GREATER');}
	else if (s[0].length < s[1].length) {console.log('LESS');}
	else {console.log(rec(s[0].slice(0), s[1].slice(0)));}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const long long mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    ll sum = 0;
    ll ans1 = 0, ans2 = 0;
    rep(i, n)
    {
        sum += a[i];
        if (i % 2 == 0)
        {
            if (sum <= 0)
            {
                ans1 += abs(1 - sum);
                sum = 1;
            }
        }
        else
        {
            if (sum >= 0)
            {
                ans1 += abs(-1 - sum);
                sum = -1;
            }
        }
    }
    sum = 0;
    rep(i, n)
    {
        sum += a[i];
        if (i % 2 == 1)
        {
            if (sum <= 0)
            {
                ans2 += abs(1 - sum);
                sum = 1;
            }
        }
        else
        {
            if (sum >= 0)
            {
                ans2 += abs(-1 - sum);
                sum = -1;
            }
        }
    }
    cout << min(ans1, ans2) << endl;
    return 0;
}


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

int main()
{
    int h,w;
    cin >> h >> w;
    for(int i=0; i<w+2; i++) cout << "#";
    cout << endl;
    for(int i=0; i<h; i++){
        cout << "#";
        for(int j=0; j<w; j++){
            char t;
            cin >> t;
            cout << t;
        }
        cout << "#" << endl;
    }
    
    for(int i=0; i<w+2; i++) cout << "#";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, K,W, H, Q, X, Y;
  ll ans;
  string S, T;
  cin >> A >> B >> K;
  if (B-A>=2*K){
    rep_s(i, A, K+A) cout << i << endl;
  	rep_s(i, B-K+1, B+1) cout << i << endl;
  }
  else {
    rep_s(i, A, B+1) cout << i << endl;
  }
  
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;


int main() {
    string S;
    string s;
    s.push_back('s');
    cin >> S;
    if (S[S.size() - 1] == s[0]) {
        S.push_back('e');
        S.push_back('s');
    }
    else {
        S.push_back('s');
    }
    cout << S << endl;
    return 0;
}

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

#define pb push_back
#define ll long long
#define maxn 100005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m,k;
	while(cin >> n >> m >> k){
		int ans = min(n*m,k);
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> f(n), c(n);
    int a = 0;
    for (int i = 0; i < m; i++) {
        int p;
        cin >> p;
        string s;
        cin >> s;
        --p;
        if (f[p]) {
            continue;
        }
        if (s == "AC") {
            a++;
            f[p] = 1;
        } else {
            c[p]++;
        }
    }
    int b = 0;
    for (int i = 0; i < n; i++) {
        if (f[i]) {
            b += c[i];
        }
    }
    cout << a << " " << b << endl;
}


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

using namespace std;

#define frei(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define fred(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define fri(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define frd(i,n) for (int i = (n) - 1; i >= 0; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )

#define uint64 unsigned long long
#define int64 long long
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
#define pr pair

#define BIT(n) (1<<(n))
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a) | (b))
#define XOR(a,b) ((a) ^ (b))
#define sqr(x) ((x) * (x))

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define PI 3.1415926535897932385
#define INF 1000111222
#define eps 1e-7
#define maxN 5005



int main(int argc, char const *argv[])
{
    /* code */
    int n;
    cin >> n;
    int a[n+1];
    for(int i = 1; i <= n; i++) cin >> a[i];
    int dp[n+1];
    dp[1] = dp[0] = 0;
    dp[2] = abs(a[2] - a[1]);
    for(int i  = 3; i <= n; i++) {
        dp[i] = min(abs(a[i] - a[i-2]) + dp[i-2], abs(a[i]- a[i-1]) + dp[i-1]);
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 1024
n = input()
a = list(map(int, input().split()))

c = [0] * 8
max = 0
for i in a:
    if i >= 3200:
        max += 1
    else:
        c[i // 400] = 1

min = 0
for i in range(8):
    if c[i] != 0:
        min += 1

max += min
if min == 0:
    print(1, max)
else:
    print(min, max)

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

long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}

int main() {
    long long a, b, x, y;
    cin >> a >> b;
    extGCD(a, b, x, y);
    cout << x << " " << y << endl;
}


Measured memory_bytes: 3092
#include <iostream>

int main()
{
	std::string S, T;
	std::cin >> S >> T;

	int match = 0;
	for(int i = 0; i < 3; i++){
		if (S[i] == T[i])
			match++;
	}

	std::cout << match << std::endl;

	return 0;

}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List
import Data.Function

alternateSplit :: [a] -> ([a],[a])
alternateSplit = foldr (\x (l,r)-> (x:r,l)) ([],[])

solve :: [Int] -> Int
solve v
  | allSame v = length v `div` 2 
  | otherwise =
    let (l,r) = alternateSplit v
        ml1 = mode l
        ml2 = mode . filter (/=ml1) $ l
        mr1 = mode r
        mr2 = mode . filter (/=mr1) $ r
     in if ml1 /= mr1
           then cnt ml1 l + cnt mr1 r
           else min (cnt ml1 l + cnt mr2 r) (cnt ml2 l + cnt mr1 r)
  where
    allSame v = all (== head v) v
    mode = head . maximumBy (compare `on` length) . group . sort
    cnt c = length . filter (/=c)

main :: IO ()
main = do
    n <- readLn :: IO Int
    v <- map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    print $ solve v


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

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>

#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

#define all(v) v.begin(), v.end()

#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define cout(n) cout << fixed << setprecision(n)

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

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

  ll a, b, c;
  cin >> a >> b >> c;

  ll ans = a + b;
  chmin(ans, a + c);
  chmin(ans, b + c);

  cout << ans << endl;

  return 0;
}


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

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

const int N = 2e5+10 , mod = 1e9+7;

inline bool cmp(int& i , int& j){
   return abs(i) < abs(j);
}

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n , k;
   cin >> n >> k;
   int a[n];
   for(int i = 0 ; i < n ; i++)
      cin >> a[i];
   sort(a , a + n , cmp);
   if(a[n - k] == 0)
      return cout << 0 , 0;
   int num = 0 , id1 = -1 , id2 = -1;
   for(int i = n - 1 ; i >= n - k ; i--)
      if(a[i] < 0){
         num = 1 - num;
         id1 = i;
      }
      else if(a[i] > 0){
         id2 = i;
      }
   long double val1 = -1 , val2 = -1;
   int idd1 = -1 , idd2 = -1;
   for(int i = n - k - 1 ; i >= 0 ; i--){
      if(a[i] > 0 && num && id1 != -1){
         val1 = max(val1 , abs((long double)a[i] / a[id1]));
         idd1 = max(idd1 , i);
      }
      if(a[i] < 0 && num && id2 != -1){
         val2 = max(val2 , abs((long double)a[i] / a[id2]));
         idd2 = max(idd2 , i);
      }
   }
   if(num){
      if(max(idd1 , idd2) != -1){
         if(val1 > val2)
            swap(a[idd1] , a[id1]);
         else
            swap(a[idd2] , a[id2]);
      }
      else
         reverse(a , a + n);
   }
   int ans = 1;
   for(int i = n - 1 ; i >= n - k ; i--){
      ans = 1ll * ans * a[i] % mod;
      if(ans < 0)
         ans += mod;
   }
   cout << ans;
   return 0;
}


Measured memory_bytes: 4368
from math import sqrt, ceil
 
a, b = map(int, input().split())
 
c_a = set()
c_b = set()
 
for i in range(1, ceil(sqrt(a))+1):
  if a % i == 0:
    c_a.add(i)
    if i > 1:
        while a % i == 0:
            a = a // i
if a != 1:
    c_a.add(a)
 
for j in range(1, ceil(sqrt(b))+1):
  if b % j == 0:
    c_b.add(j)
    if j > 1:
        while b % j == 0:
            b = b // j
if b != 1:
    c_b.add(b)
 
ans = c_a.intersection(c_b)
 
print(len(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <bitset>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

ll choose2(ll n){
    return n*(n-1)/2;
}

int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    vector<int> hoge(m,0);
    ll ans = INF;

    rep(i,0,n-1){
        cin>>c[i];
        rep(j,0,m-1){
            cin>>a[i][j];
            hoge[j] += a[i][j];
        }
    }
    rep(i,0,m-1){
        if(hoge[i]<x){
            cout<<"-1"<<endl;
            return 0;
        }
    }

    rep(i,0,(1 << 12) - 1){
        bitset<12> b(i);
        vector<int> tmp(m,0);
        ll cost = 0;
        rep(j,0,n-1){
            if(b.test(j)){
                cost += c[j];
                rep(k,0,m-1){
                    tmp[k] += a[j][k];
                }
            }
        }

        bool flag = true;
        rep(j,0,m-1){
            if(tmp[j]<x){
                flag = false;
                break;
            }
        }

        if(flag) chmin(ans,cost);
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3632
from bisect import bisect_left

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))

pos = bisect_left(x, 0)
if pos < len(x) and x[pos] == 0:
    k -= 1
else:
    x.insert(pos, 0)

l = pos
r = pos+k

if r >= len(x):
    diff = r-len(x) + 1
    l -= diff
    r -= diff

ans = min(abs(x[l]), x[r])*2 + max(abs(x[l]), x[r])

while r >= pos:
    if l < 0:
        break

    dist = min(abs(x[l]), x[r])*2 + max(abs(x[l]), x[r])
    if dist < ans:
        ans = dist

    l -= 1
    r -= 1

print(ans)

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

int main() {
  int n;
  cin >> n;
  ll p = 1;
  const int mod = 1e9 + 7;
  for (int i = 1; i <= n; ++i) p = p * i % mod;
  cout << p << endl;
  return 0;
}

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

int main(){

  int n,m; 
  set<int> s;
  cin >> n;
  for(int i=0; i<n; i++){
    int tmp; cin >> tmp;
    s.insert(tmp);
  }
  cin >> m;
  int ans=0;
  for(int i=0; i<m; i++){
    int tmp; cin >> tmp;
    if(s.find(tmp) != s.end()) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 1240
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll A, B, C, D, E, F;
    cin >> A >> B >> C >> D >> E >> F;

    double max_sol = 0;
    double upper_sol = 100.0 * (double)E / (double)(100.0 + E);
    ll ans_water = 100 * A;
    ll ans_sugar = 0;

    vector<ll> waters;
    vector<ll> sugars;

    rep(i, 35) {
        rep(j, 35) {
            ll tmp_water = 100 * A * i + 100 * B * j;
            if (tmp_water == 0) continue;
            if (tmp_water > F) break;
            waters.pb(tmp_water);
        }
    }

    rep(k, 3005) {
        rep(l, 3005) {
            ll tmp_sugar = C * k + D * l;
            if (tmp_sugar == 0) continue;
            if (tmp_sugar > F) break;
            sugars.pb(tmp_sugar);
        }
    }

    // repv(waters) { cout << *it << " "; }
    // cout << endl;
    // repv(sugars) { cout << *it << " "; }
    // cout << endl;

    rep(i, SZ(waters)) {
        rep(j, SZ(sugars)) {
            if (waters[i] + sugars[j] > F) continue;

            double sol = 100.0 * (double)sugars[j] /
                         ((double)waters[i] + (double)sugars[j]);
            if (max_sol < sol && sol <= upper_sol) {
                max_sol = sol;
                ans_water = waters[i];
                ans_sugar = sugars[j];
            }
        }
        // cout << endl;
    }

    cout << ans_sugar + ans_water << " " << ans_sugar << endl;

    return 0;
}

Measured memory_bytes: 5328
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <vector>
typedef long long LL;

std::vector<LL> pos, neg;

LL count1(LL v) {
  LL cnt = 0;
  for (LL x : pos) {
    LL y = (v - x + 1) / x;
    cnt += std::upper_bound(neg.begin(), neg.end(), y) - neg.begin();
  }
  return cnt;
}

LL count2(LL v) {
  LL cnt = 0;
  for (LL x : pos) {
    LL y = v / x;
    cnt += std::upper_bound(pos.begin(), pos.end(), y) - pos.begin();
    if (x * x <= v) --cnt;
  }

  for (LL x : neg) {
    LL y = v / x;
    cnt += std::upper_bound(neg.begin(), neg.end(), y) - neg.begin();
    if (x * x <= v) --cnt;
  }

  return cnt/2;
}

int main() {
  LL N, K; std::cin >> N >> K;
  LL zero = 0;
  for (int i = 0; i < N; ++i) {
    LL a; std::cin >> a;
    if (a < 0)       neg.push_back(a);
    else if (a > 0 ) pos.push_back(a);
    else             ++zero;
  }

  std::sort(neg.begin(), neg.end());
  std::sort(pos.begin(), pos.end());

  LL neg_patterns = neg.size() * pos.size();
  LL zero_patterns = zero * (neg.size()+pos.size()) + zero * (zero-1) / 2;
  LL ans = 0;
  if (neg_patterns >= K) {
    LL ok  = 0;
    LL ng  = -1e18;
    while (ng + 1LL != ok) {
      LL mid = (ok + ng) / 2;
      if (count1(mid) >= K) ok = mid;
      else                  ng = mid;
    }
    ans = ok;
  } else if (neg_patterns + zero_patterns >= K) {
    ans = 0LL;
  } else {
    K -= neg_patterns;
    K -= zero_patterns;

    auto tmp = neg;
    for (int i = 0; i < neg.size(); ++i) {
      neg[i] = std::abs(tmp[tmp.size()-i-1]);
    }

    LL ng  = 0;
    LL ok  = 1e18;
    while (ng + 1LL != ok) {
      LL mid = (ok + ng) / 2;
      if (count2(mid) >= K) ok = mid;
      else                  ng = mid;
    }
    ans = ok;
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 3056
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String ans = "";
        if(a > b){
            ans = "a > b";
        } else if(a < b){
            ans = "a < b";
        } else {
            ans = "a == b";
        }
        System.out.println(ans);
        sc.close();
    }
}


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

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+5; 

const double PI =  3.14159265;

int main(){
	IO;
	int n, m, ans = 0;
	cin>>n>>m;
	ans += n*(n-1)/2;
	ans += m*(m-1)/2;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

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

const ll mod = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//



int N,A,B,C;
vector<int> l;




int dfs(int a, int b, int c, int i)
{
        if(i == N) {
                if(a == 0 || b == 0 || c == 0) return 1e9;
                return abs(a - A) + abs(b - B) + abs(c - C) - 30;
        }

        int val1 = dfs(a + l[i], b, c, i+1) + 10;
        int val2 = dfs(a, b + l[i], c, i+1) + 10;
        int val3 = dfs(a, b, c + l[i], i+1) + 10;
        int val4 = dfs(a, b, c, i+1);

        return min({val1, val2, val3, val4});
}






int main()
{
        cin >> N >> A >> B >> C;
        l.resize(N);
        for (int i = 0; i < N; i++) cin >> l[i];

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






















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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    vector<char> go_key;
    vector<char> back_key;

    if( sy > ty )
    {
        rep(i, sy-ty)
        {
            go_key.push_back('D');
            back_key.push_back('U');
        }
    }
    else 
    {
        rep(i, ty-sy)
        {
            go_key.push_back('U');
            back_key.push_back('D');
        }
    }
    if( sx > tx )
    {
        rep(i, sx-tx)
        {
            go_key.push_back('L');
            back_key.push_back('R');
        }
    }
    else 
    {
        rep(i, tx-sx)
        {
            go_key.push_back('R');
            back_key.push_back('L');
        }
    }

    
    rep(i,go_key.size()) cout << go_key[i];
    rep(i,back_key.size()) cout << back_key[i];
    
    if( sx < tx ) cout << 'L' << go_key[0];
    else cout << 'R' << go_key[0];
    rep(i,go_key.size()) cout << go_key[i];
    cout << go_key[go_key.size()-1] << back_key[0];

    if( sx < tx == 'R' ) cout << 'L' << back_key[0];
    else cout << 'R' << back_key[0];
    rep(i,back_key.size()) cout << back_key[i];
    cout << back_key[back_key.size()-1] << go_key[0];
    cout << endl;
}


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

long int GreatestCommonDivisor(long int a, long int b) {
    while(true) {
        if(a < b) swap(a, b);
        if(!b) break;
        a %= b;
    }
    return a;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    long int N, M;
    cin >> N >> M;
    string S, T;
    cin >> S >> T;
    long int lcm = N * M / GreatestCommonDivisor(N, M);
    vector<long int> SLength, TLength;
    SLength.push_back(1);
    TLength.push_back(1);
    for (long int i = 1; i < N; ++i) {
        SLength.push_back((lcm / N) * i + 1);
    }
    for (long int i = 1; i < M; ++i) {
        TLength.push_back((lcm / M) * i + 1);
    }
    vector<pair<int, char>> ans(20100);
    for (int i = 0; i < N; ++i) {
        ans.emplace_back(SLength[i], S[i]);
    }
    for (int i = 0; i < M; ++i) {
        ans.emplace_back(TLength[i], T[i]);
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size() - 1; ++i) {
        if (ans[i].first == ans[i + 1].first && ans[i].second != ans[i + 1].second) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << lcm << endl;
    return 0;
}


Measured memory_bytes: 5820
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    REP(i, H) {
        REP(j, W) {
            char c;
            cin >> c;
            S[i][j] = c;
        }
    }
    vector<vector<int>> acc(H, vector<int>(W, 0));
    REP(i, H) {
        int l = 0, sum = 0;
        REP(j, W) {
            if (S[i][j] == '.') {
                sum++;
                continue;
            }
            FOR(k, l, j, 1) {
                acc[i][k] = sum;
            }
            l = j + 1;
            sum = 0;
        }
        FOR(k, l, W, 1) {
            acc[i][k] = sum;
        }
    }
    REP(j, W) {
        int t = 0, sum = 0;
        REP(i, H) {
            if (S[i][j] == '.') {
                sum++;
                continue;
            }
            FOR(k, t, i, 1) {
                acc[k][j] += sum;
            }
            t = i + 1;
            sum = 0;
        }
        FOR(k, t, H, 1) {
            acc[k][j] += sum;
        }
    }
    int res = 0;
    REP(i, H) {
        REP(j, W) {
            amax(res, acc[i][j] - 1);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 19968
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

class UnionFind:
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rank = [0]*(n+1)

    # ノードxのrootノードを見つける
    def findRoot(self, x):
        if(self.root[x] < 0): # 根
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.findRoot(self.root[x])
            return self.root[x]

    # 木の併合、入力は併合したい各ノード
    def unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.findRoot(x)
        y = self.findRoot(y)

        # すでに同じ木に属していた場合
        if x == y:
            return 

        # 違う木に属していた場合rankを見てくっつける方を決める
        if self.rank[x] > self.rank[y]:
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.findRoot(x) == self.findRoot(y)

    # ノードxが属する木のサイズを返す
    def count(self, x):
        return -self.root[self.findRoot(x)]

def main():
    n, m = i_map()

    uf = UnionFind(n)

    for _ in range(m):
        a, b = i_map()
        uf.unite(a, b)

    count = 0
    for i in range(2, n+1):
        if uf.isSameGroup(1, i):
            continue
        uf.unite(1, i)
        count += 1

    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 80800
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        int H = sc.nextInt();
        int W = sc.nextInt();

        int ans = 0;
        for (int i = 0; i < N; i++) {
            int A = sc.nextInt();
            int B = sc.nextInt();

            if (H <= A && W <= B) {
                ans += 1;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 24660
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S; cin >> S;
    if (S=="RSR") {
        cout << 1 << ln;
        return 0;
    }
    int cnt = 0;
    rep(i,3) if (S[i]=='R') cnt++;
    cout << cnt << ln;
}


Measured memory_bytes: 3652
#include <queue>
#include <map>
#include <cstdio>
using namespace std;
main(){
	int t=0,T,i,j,k;
	map<int,vector<int> >a;
	for(scanf("%d",&T);t<T;t++)for(scanf("%d%d",&i,&k);k--;a[i].push_back(j))scanf("%d",&j);
	map<int,int>m;
	queue<int>q;
	for(q.push(1),m[1]=1;!q.empty();){
		k=q.front();q.pop();
		for(i=0;i<a[k].size();i++)if(!m[a[k][i]])m[a[k][i]]=m[k]+1,q.push(a[k][i]);
	}
	for(i=1;i<=T;i++)printf("%d %d\n",i,m[i]-1);
}



Measured memory_bytes: 2840