akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
const int inf=1000000007;
const int MOD=1000000007;
struct Tree{
  bool tag;
  bool comp;
  vector<int> edge;
  int count(){
    int num=edge.size();
    return num;
  }
};
signed main(){
  int n;cin>>n;
  vector<Tree> tree(n+1);
  rep(i,n-1){
    int a,b;cin>>a>>b;
    tree[a].edge.push_back(b);
    tree[b].edge.push_back(a);
  }
  rep(i,n+1){
    //tree[i].tag=true;
    tree[i].comp=true;
    //cout<<i<<endl;
  }
  //return 0;
  //tree[0].comp=true;
  queue<int> que;que.push(1);
  tree[1].comp=false;
  tree[1].tag=true;
  while(!que.empty()){
    int buf=que.front();que.pop();
    int num=tree[buf].count();
    rep(i,num){
      if(tree[tree[buf].edge[i]].comp){
        tree[tree[buf].edge[i]].comp=false;
        que.push(tree[buf].edge[i]);
        tree[tree[buf].edge[i]].tag=!tree[buf].tag;
      }
    }
  }
  int T=0;int F=0;
  rep1(i,n){
    if(tree[i].tag)T++;
    else F++;
  }
  
  int one=0;int two=0;int three=0;
  if(T<=n/3){
    rep1(i,n){
      if(tree[i].tag){
        three++;
        cout<<three*3;
      }
      else{
        one++;
        if(one%3==0)one++;
        if(one>n){
          three++;
          cout<<three*3;
        }
        else cout<<one;
      }
      cout<<" ";
    }
  }
  else if(F<=n/3){
    rep1(i,n){
      if(!tree[i].tag){
        three++;
        cout<<three*3;
      }
      else{
        one++;
        if(one%3==0)one++;
        if(one>n){
          three++;
          cout<<three*3;
        }
        else cout<<one;
      }
      cout<<" ";
    }
  }
  else{
    rep1(i,n){
      if(tree[i].tag){
        if(one*3+1<=n){
          cout<<one*3+1;
          one++;
        }
        else{
          three++;
          cout<<three*3;
        }
      }
      else{
        if(two*3+2<=n){
          cout<<two*3+2;
          two++;
        }
        else{
          three++;
          cout<<three*3;
        }
      }
      cout<<" ";
    }
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 16744
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

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

  cin >> n;
  cout << (n * n) << endl;
}


Measured memory_bytes: 256
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    cout<<min(A,B)+min(C,D)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        String s = stdIn.next();

        char [] cs = s.toCharArray();

        int max = 0;
        int temp = 0;
        for(int i=0; i<cs.length; i++){
            if(isACGT(cs[i])){
                temp++;
                if(temp > max){
                    max = temp;
                }
            }else{
                temp = 0;
            }
        }

        System.out.println(max);
    }

    static boolean isACGT(char c){
        if(c == 'A' || c == 'C' || c == 'G' || c == 'T'){
            return true;
        }
        return false;
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

int main()
{
    int N;
    cin >> N;
    int x[200000];
    for(int i = 0; i < N; ++i) cin >> x[i];
    vector<pair<int, int>> v;
    v.reserve(N);
    for(int i = 0; i < N; ++i) v.push_back(make_pair(x[i], i));

    int y[200000];
    sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b) -> int {return a.first < b.first;});
    int mid_right = v[N/2].first;
    int mid_left = v[(N-1)/2].first;
    for(int i = 0; i < N; ++i){
        if(v[i].first >= mid_right)
            y[v[i].second] = mid_left;
        else
            y[v[i].second] = mid_right;
    }
    for(int i = 0; i < N; ++i)
        cout << y[i] << endl;

    return 0;
}

Measured memory_bytes: 5376
from functools import reduce

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

n, x = map(int, input().split())
town = map(int, input().split())

d = map(lambda z: abs(z - x), town)
res = reduce(gcd, d)

print(res)


Measured memory_bytes: 11596
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    
    public static void nibutan(int array[], int length, int num){
        int pos = -1;
        int lower = 0; //最小index番号
        int upper = length - 1; // 最大index番号
        
        while (lower <= upper) {
            int mid = (lower + upper) / 2;
            
            if (array[mid] >= num) {
                upper = mid;
            } else if (array[mid] < num) {
                lower = mid;
            }
            
            if(upper - lower == 1){
                if(array[lower] < num && array[upper] >= num){
                    pos = upper;
                }else if(array[lower] >= num){
                    pos = 0;
                }else{
                    pos = length;
                }
                break;
            }
            
            if(upper == lower){
                if(array[0] < num){
                    pos = length;
                }else{
                    pos = 0;
                }
                break;
            }
        }
        
        System.out.println(pos);
    }
    
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++){ 
            a[i] = stdIn.nextInt();
        }
        
        int q = stdIn.nextInt();
        
        for(int i = 0; i < q; i++){
            int k = stdIn.nextInt();
            nibutan(a, n, k); //左から配列、配列の長さ、探索する数字
        }
        
        stdIn.close();
    }
}



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

const int maxn=505;
const int maxm=maxn*maxn;

int tot,n,m,a[maxn][maxn],A[maxm],B[maxm],C[maxm],D[maxm];

void addd(int x1,int y1,int x2,int y2)
{
	tot++;
	A[tot]=x1;
	B[tot]=y1;
	C[tot]=x2;
	D[tot]=y2;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)scanf("%d",&a[i][j]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<m;j++)if(a[i][j]&1)
		{
			a[i][j]--;
			a[i][j+1]++;
			addd(i,j,i,j+1);
		}
	for(int i=1;i<n;i++)if(a[i][m]&1)
	{
		a[i][m]--;
		a[i+1][m]++;
		addd(i,m,i+1,m);
	}
	printf("%d\n",tot);
	for(int i=1;i<=tot;i++)printf("%d %d %d %d\n",A[i],B[i],C[i],D[i]);
	return 0;
}

Measured memory_bytes: 6016
#include <cstdio>
#include <cstdlib>
using namespace std;


int n;
int bit[100001];

int sum(int i) {
	int s = 0;
	while(i > 0) {
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(int i, int x) {
	while(i <= n) {
		bit[i] += x;
		i += i & -i;
	}
}
 
int cnt[100001];
 
inline void inc_divisor(int n) {
	for(int i = 1; i * i <= n; ++i) {
		if(n % i == 0) {
			++cnt[i];
			if(cnt[i] == 2)
				add(i, 1);

			if(i != n / i) {
				++cnt[n / i];
				if(cnt[n / i] == 2)
					add(n / i, 1);
			}
		}
	}
}

inline void dec_divisor(int n) {
	for(int i = 1; i * i <= n; ++i) {
		if(n % i == 0) {
			--cnt[i];
			if(cnt[i] == 1)
				add(i, -1);

			if(i != n / i) {
				--cnt[n / i];
				if(cnt[n / i] == 1)
					add(n / i, -1);
			}
		}
	}
}
 
int main() {
	int w;
	scanf("%d %d", &n, &w);

	for(int i = 1; i < w; ++i)
		inc_divisor(i);
 
	for(int i = 1; i <= n - w + 1; ++i) {
		inc_divisor(i + w - 1);

		if(i == n - w + 1)
			printf("%d\n", w + sum(i - 1));
        else
        	printf("%d ", w + sum(i - 1));

        dec_divisor(i);
    }
 
    return EXIT_SUCCESS;
}

Measured memory_bytes: 1624
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n,m,k;
    cin>>n>>m>>k;
    int a[m];
    rep(i,m){
        cin>>a[i];
        --a[i];
    }
    map<int,int> mp;
    rep(i,m)mp[a[i]]=i;
    int v[n][k];
    rep(i,n){
        rep(j,k){
            cin>>v[i][j];
            --v[i][j];
        }
    }

    int all=1<<m;
    vector<int> dist(all,inf);
    dist[all-1]=0;
    queue<int> que;
    que.push(all-1);
    while(que.size()){
        int p=que.front();
        que.pop();
        vector<int> cur;
        rep(i,m){
            if(p&(1<<i))cur.push_back(a[i]);
        }
        rep(i,k){
            int nxt=0;
            for(auto e : cur){
                if(mp.count(v[e][i])){
                    nxt|=1<<mp[v[e][i]];
                }
            }
            if(dist[nxt]>dist[p]+1){
                dist[nxt]=dist[p]+1;
                que.push(nxt);
            }
        }
    }
    cout<<dist[0]<<endl;
    return 0;
}


Measured memory_bytes: 3460
function Main(input){
  input = input.trim();
  let [h, m, s,] = [0, 0, 0];

  for (let i = 1; i <= input; i++){
    s++; 
    if (s === 60) {
      m++;
      s = s - 60;
    } else if (m === 60) {
      h++;
      m = m - 60;
    }
  }

  if (s === 60) {
      m++;
      s = s - 60;
    } else if (m === 60) {
      h++;
      m = m - 60;
    }

  console.log(`${h}:${m}:${s}`);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 15116
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var nabcd = Input.ar;
        var str = ReadLine().Trim();

        if (nabcd[3] > nabcd[4])
        {
            for (var i = nabcd[1] - 1; i < nabcd[3] - 1; i++)
                if (str[i] == str[i + 1] && str[i] == '#')
                { WriteLine("No"); return; }
            for (var i = nabcd[2] - 1; i < nabcd[4] - 1; i++)
                if (str[i] == str[i + 1] && str[i] == '#')
                { WriteLine("No"); return; }
            for (var i = nabcd[2] - 2; i < nabcd[4] - 1; i++)
                if (str[i] == str[i + 1] && str[i] == str[i + 2] && str[i] == '.')
                { WriteLine("Yes");return; }
            WriteLine("No");
        }
        else
        {
            for (var i = nabcd[2] - 1; i < nabcd[4] - 1; i++)
                if (str[i] == str[i + 1] && str[i] == '#')
                { WriteLine("No"); return; }
            for (var i = nabcd[1] - 1; i < nabcd[3] - 1; i++)
                if (str[i] == str[i + 1] && str[i] == '#')
                { WriteLine("No"); return; }
            WriteLine("Yes");
        }
    }
    
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		
		while(true) {
			int n=in.nextInt();
			
			if(n==0)break;
			point p[]=new point[n];
			p[0]=new point(); p[0].x=0; p[0].y=0;
			int S=0,N=0,E=0,W=0;;


			for(int i=1;i<n;i++) {
				p[i]=new point();
				int prev=Integer.parseInt(in.next()), d=Integer.parseInt(in.next());

				if(d==0) {
					p[i].x=p[prev].x-1;
					p[i].y=p[prev].y;
					if(p[i].x<W)W=p[i].x;
				}
				else if(d==1) {
					p[i].y=p[prev].y-1;
					p[i].x=p[prev].x;
					if(p[i].y<N)N=p[i].y;
				}
				else if(d==2) {
					p[i].x=p[prev].x+1;
					p[i].y=p[prev].y;
					if(p[i].x>E)E=p[i].x;
				}
				else if(d==3) {
					p[i].y=p[prev].y+1;
					p[i].x=p[prev].x;
					if(p[i].y>S)S=p[i].y;
				}
			}
			
			//System.out.printf("%d %d %d %d\n",W,E,N,S);
			System.out.println((E-W+1)+" "+(S-N+1));
		}

		

	}

}

class point{
	int x,y;
}



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

int main() {
    /* Input */
    int N, X, T;
    cin >> N >> X >> T;
    
    /* Main Logic */      
    int num = 0;
    if (N % X) num = N / X + 1;
    else num = N / X;

    /* Output */
    cout << num * T << endl;
    return 0;
}

Measured memory_bytes: 3640
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        
        for(int i = y/10000;i >= 0;i--)
            for(int j = 0;10000*i+5000*j <= y;j++){
                if(10000*i+5000*j+1000*(n-i-j) == y ){
                    System.out.println(i+" "+j+" "+(n-i-j));
                    return;
                }
            }
                
            
        System.out.println((-1)+" "+(-1)+" "+(-1));
    }
}


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

int main() {
  int N;
  cin>>N;
  double p[3010];
  for(int i=0;i<N;i++){
    cin>>p[i];
  }
  double dp[3010][3010];
  dp[0][0]=1;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=i;j++){
      dp[i+1][j]+=dp[i][j]*(1-p[i]);
      dp[i+1][j+1]+=dp[i][j]*(p[i]);
    }
  }
  double ans=0;
  for(int i=N;i>(N/2);i--){
    ans+=dp[N][i];
  }
  cout<<setprecision(10)<<ans<<endl;
  //cout<<dp[3][3]<<" "<<dp[3][2]<<" "<<dp[3][1]<<" "<<dp[3][0]<<endl;
  return 0;
}


Measured memory_bytes: 49984
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let v = input_vector::<usize>();
    let mut count = 1;
    for z in v {
        if z == count {
            count += 1;
        }
    }
    if count == 1 {
        p(-1);
    } else {
        p(n - (count - 1));
    }
}


Measured memory_bytes: 10492
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;

bool check(ll v, ll k, vector<ll> &A) {
    vector<ll> C = A;
    int N = C.size();
    rep(i, N) C[i] %= v;
    sort(All(C));
    vector<int> sum(N + 1);
    rep(i, N) sum[i + 1] = sum[i] + C[i];
    FOR(i, 1, N) {
        ll A = sum[i];
        ll B = (N - (ll)i) * v - (sum[N] - sum[i]);
        if(max(A, B) <= k)
            return true;
    }
    return false;
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll sum = 0;
    rep(i, N) sum += A[i];
    ll res = 0;
    for(ll i = 1; i * i <= sum; i++) {
        if(sum % i == 0) {
            if(check(i, K, A))
                res = max(i, res);
            if(check(sum / i, K, A))
                res = max(sum / i, res);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#include <bitset>
#include <iomanip>
#include <map>
#include <queue>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Graph = vector<vector<T>>;

void printFixedDouble(double d, int fix) {
    cout << std::fixed;
    cout << std::setprecision(fix) << d << endl;
}

int main() {
    int inputNum;
    cin >> inputNum;
    int max = 0;
    int min = 1000000;
    vector<pii> list;
    rep(i, inputNum) {
        int a, b;
        cin >> a >> b;
        min = std::min(min, (a + 1)/2);
        max = std::max(max, b);
        list.push_back(pii(a, b));
    }

    std::map<int, bool> isPrime;
    std::map<int, int> ruiseki;
    ruiseki[min*2-1] = 0;

    reps(i, min, max + 1) {
        if (i == 1) {
            isPrime[i] = false;
            goto OUT;
        }
        for (int j = 2; j*j <= i; j++) {
            if (i % j == 0) {
                isPrime[i] = false;
                goto OUT;
            }
        }
        isPrime[i] = true;
        OUT:
        ;
        if (min*2 - 1 <= i && i % 2 == 1) {
            ruiseki[i+2] = ((isPrime[i] && isPrime[(i + 1) / 2]) ? 1 : 0) + ruiseki[i];
            // cout << "ruiseki " << i+2 << ": " << ruiseki[i+2] << endl;
        }
    }

    for(auto& p : list) {
        // int counter = 0;
        // for (int i = p.first; i <= p.second; i+= 2) {
        //     if (isPrime[i] && isPrime[(i + 1) / 2]) counter++;
        //     // cout << i << " " << counter << endl;
        // }
        cout << ruiseki[p.second+2] - ruiseki[p.first] << endl;
    }
}

Measured memory_bytes: 8436
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ld long double
#define mem(a,b) memset(a,b,sizeof(a) )
#define M 4000010
#define md 1000000007

ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}
/*inline ll add(ll a,ll b){return (a+b)%md;}
inline ll mul(ll a,ll b){return (a*b)%md;}
ll f[M],iv[M];
ll C(ll n,ll r){return mul(f[n],mul(iv[r],iv[n-r]));}
void prep_fac(){
    f[0]=1;
    rep(i,1,M)f[i]=mul(i,f[i-1]);
    iv[M-1]=power(f[M-1],md-2,md);
    for(ll i=M-2;i>=0;--i)iv[i]=mul(i+1,iv[i+1]);
}*/



int main()
{
	IOS;
	string s="";
	int l;cin>>l;
	for(int i=0;i<l;i++)s+="ACL";
	cout<<s;
}



Measured memory_bytes: 3584
N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print("Yes")
    exit()

flag = True
for i in range(N-1, -1, -1):

    if H[i] >= H[i-1]:
        pass
    elif H[i] + 1 == H[i-1]:
        H[i-1] -= 1

for i in range(N-1):
    if H[i] > H[i+1]:
        flag = False

if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 85280
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{

  int N;
  cin >> N;

  vector<int> mon(N + 1);
  rep(i, N + 1)
  {
    cin >> mon[i];
  }

  vector<int> hero(N);
  rep(i, N)
  {
    cin >> hero[i];
  }

  long long defeat = 0;
  rep(i, N)
  {
    if (hero[i] > mon[i])
    {
      defeat += mon[i];
      int diff = hero[i] - mon[i];
      defeat += std::min(diff, mon[i + 1]);
      mon[i + 1] = std::max(0, mon[i + 1] - diff);
    }
    else
    {
      defeat += hero[i];
    }
  }
  cout << defeat << endl;

  return 0;
}


Measured memory_bytes: 4032
const input = require("fs").readFileSync("/dev/stdin", "utf8");

const value = input.trim().split("\n")
const str = value.toString();

const hon = [2, 4, 5, 7, 9]
const pon = [0, 1, 6, 8]
const bon = 3
 
const t = parseInt(str[str.length - 1], 10);

if (hon.includes(t)) {
  console.log('hon')
} else if (pon.includes(t)) {
  console.log('pon')
} else if (t === 3) {
  console.log('bon')
}

Measured memory_bytes: 29976
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
    int a,b,max,c,d,e;
    scanf("%d%d",&a,&b);
    c=a+b;d=a-b;e=a*b;
    max=c;
    if(max<d)
        max=d;
    if(max<e)
        max=e;
    printf("%d",max);
    return 0;
}



Measured memory_bytes: 128
import sys
import itertools as it
input = sys.stdin.readline

N, M, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

AS = list(it.accumulate(A))
BS = list(it.accumulate(B))
AS.insert(0,0)
BS.insert(0,0)
max = 0
for i in range(N+1):
    a = AS[i]
    if a > K:
        continue
    if max - i > 0:
        j = max - i
    else:
        j = 0
    while j < M + 1:
        b = BS[j]
        if a + b > K:
            break
        if max < i + j:
            max = i + j
        j += 1

print(max)

Measured memory_bytes: 124328
n,m=map(int,input().split())
h=list(map(int,input().split()))
ans=0
l=[[] for i in range(n+1)]
for j in range(m):
  a,b=map(int,input().split())
  l[a].append(b)
  l[b].append(a)
for i in range(1,n+1):
  now=l[i]
  on=0
  for j in now:
    if h[i-1]>h[j-1]:
      on+=1
  if on==len(now):
    ans+=1
print(ans)

Measured memory_bytes: 29428
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

pint ab[100001];
int main(){
    int n,m,ai,bi;
    cin>>n>>m;
    rep(i,m){
        cin>>ai>>bi;
        ab[i]={bi,ai};
    }
    sort(ab,ab+m);
    int cur=0,cnt=0;
    rep(i,m){
        if(cur<=ab[i].second){
            ++cnt;
            cur=ab[i].first;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
using namespace std;
string s,t;
int r1[26],r2[26];
int main(){
    cin>>s>>t;
    for(int i=0;i<26;i++){
        r1[i]=-1;
        r2[i]=-1;
    }
    int n=s.size();
    int end=false;
    for(int i=0;i<n;i++){
        int S=int(s[i]-'a'),T=int(t[i]-'a');
        if(r1[S]<0) r1[S]=T;
        else if(r1[S]!=T) end=true;
        if(r2[T]<0) r2[T]=S;
        else if(r2[T]!=S) end=true;
        if(end){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
//typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){int i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,t;
  cin>>s;
  t=s;
  reverse(t.begin(),t.end());
  for(auto &I:t){
    if(I=='b'){I='d';}
    else if(I=='d'){I='b';}
    else if(I=='p'){I='q';}
    else if(I=='q'){I='p';}
  }
  cout<<(s==t?"Yes":"No")<<endl;


  return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.math.BigInteger;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    BigInteger ans  = BigInteger.ONE;
    long l = (long)Math.pow(10,18);
    BigInteger L = BigInteger.valueOf(l);
    while(sc.hasNext()){
      long a = sc.nextLong();
      if (a == 0) {
        ans = BigInteger.ZERO;
      } else if (ans.compareTo(L) <= 0) {
        ans = ans.multiply(BigInteger.valueOf(a));
      }
    }
    if(ans.compareTo(L) <= 0){
      System.out.println(ans);
    }else{
      System.out.println(-1);
    }
  }  
}

Measured memory_bytes: 62736
<?php

fscanf(STDIN, "%s", $n);
fscanf(STDIN, "%d", $k);

$digit_of_n = strlen($n);

$certainly_less_than_n = array_pad([], $digit_of_n + 1, array_pad([], $digit_of_n + 1, 0));
$uncertainly_less_than_n = array_pad([], $digit_of_n + 1, array_pad([], $digit_of_n + 1, 0));
$uncertainly_less_than_n[0][0] = 1;

for ($i = 0; $i < $digit_of_n; ++$i) {
    $threshold = (int)substr($n, $i, 1);

    $max_j = min($i, $k);
    for ($j = 0; $j <= $max_j; ++$j) {
        for ($d = 0; $d < 10; ++$d) {
            $new_j = $d === 0 ? $j : $j + 1;
            if ($new_j > $k) {
                continue;
            }

            $certainly_less_than_n[$i + 1][$new_j] += $certainly_less_than_n[$i][$j];
            if ($d === $threshold) {
                $uncertainly_less_than_n[$i + 1][$new_j] += $uncertainly_less_than_n[$i][$j];
            } elseif ($d < $threshold) {
                $certainly_less_than_n[$i + 1][$new_j] += $uncertainly_less_than_n[$i][$j];
            }
        }
    }
}

echo $certainly_less_than_n[$digit_of_n][$k] + $uncertainly_less_than_n[$digit_of_n][$k];


Measured memory_bytes: 16676
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<chrono>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);


int d;
int s[365][26];
int c[26];


int calc(vector<int> v) {
	int sum = 0;
	int las[26]; rep(i, 26)las[i] = 0;


	int dec = 0;
	rep(j, 26)dec += c[j];

	int aldec = 0;

	rep(i, d) {
		aldec -= c[v[i]] * (i - las[v[i]]);

		sum += s[i][v[i]];
		las[v[i]] = i;

		sum -= aldec;
		aldec += dec;
	}
	return sum;
}

void query(vector<int> v) {
	rep(i, d) {
		cout << v[i] + 1 << "\n";
	}
}
void solve() {
	cin >> d;
	rep(i, 26)cin >> c[i];
	rep(i, d)rep(j, 26)cin >> s[i][j];

	//init_answer
	vector<int> v;
	int las[26]; rep(j, 26)las[j] = 0;
	int sum = 0;

	rep(i, d) {
		int ma = -mod;
		int chk = -1;
		rep(j, 26) {
			int ad = s[i][j];
			ad += c[j] * (i - las[j]);
			if (ma < ad) {
				ma = ad;
				chk = j;
			}
		}
		v.push_back(chk);
		las[chk] = i;

		sum += s[i][chk];
		rep(j, 26) {
			sum -= c[j] * (i - las[j]);
		}
	}

	mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
	uniform_int_distribution<> ud(0, d - 1);
	uniform_real_distribution<> rd(0.0, 1.0);
	vector<int> alt = v;


	int cur = sum;
	//cout << cur << "\n";

	rep(i, 30000) {
		int id = ud(mt);
		rep(j, 26) {
			if (j == v[id])continue;
			alt[id] = j;
			int val = calc(alt);
			if (cur < val) {
				//cout <<i<<" "<< val - cur << "\n";
				v = alt;
				cur = val;
				break;
			}
		}
		alt = v;
	}

	//cout << cur << "\n";
	query(v);
}


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


Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    string s; cin >> s;
    ll ans = 0;
    rep(i,s.size()){
        if(s[i]=='+') ans++;
        else ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	float a,b;
	while(cin>>a>>b){
		if(a<35.5&&b<71.0){
			cout<<"AAA"<<endl;
		}
		else if(a<37.5&&b<77.0){
			cout<<"AA"<<endl;
		}
		else if(a<40.0&&b<83.0){
			cout<<'A'<<endl;
		}
		else if(a<43.0&&b<89.0){
			cout<<'B'<<endl;
		}
		else if(a<50.0&&b<105.0){
			cout<<'C'<<endl;
		}
		else if(a<55.0&&b<116.0){
			cout<<'D'<<endl;
		}
		else if(a<70.0&&b<148.0){
			cout<<'E'<<endl;
		}
		else{
			cout<<"NA"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3196
def solve(s_list, t_list):
    ans = 0
    s_length = len(s_list)
    for t in t_list:
        left, right = 0, s_length
        if binary_search(s_list, left, right, t):
            ans += 1
    return ans


def binary_search(s_list, left, right, t):
    # [left, right)
    if right > left:
        mid = (left + right) // 2
        if s_list[mid] == t:
            return True
        elif s_list[mid] > t:
            right = mid
        else:
            left = mid + 1
        return binary_search(s_list, left, right, t)
    return False


def main():
    n = int(input())
    s_list = list(map(int, input().split()))
    q = int(input())
    t_list = list(map(int, input().split()))

    ans = solve(s_list, t_list)
    print(ans)


main()



Measured memory_bytes: 16712
a, b = map(int,input().split())
 
x = a + b
y = a - b
z = a*b
 
if x != y and y != z and x != z:
    if x > y and x > z:
        print(x)
    else:
        if y > z:
            print(y)
        else:
            print(z)
else:
    pass
if x == y and y ==  z and x == z:
    print(x)
else:
    pass
if x == y and x != z:
    if x > z:
        print(x)
    else:
        print(z)
else:
    pass
if y == z and y != x:
    if y > x:
        print(y)
    else:
        print(x)
else:
    pass
if x == z and x != y:
    if x > y:
        print(x)
    else:
        print(y)
else:
    pass

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
 
using namespace std;

static const int MAX = 100;
static const int INFTY = (1<<21);
static const int white =0;
static const int gray = 1;
static const int black = 2;

int n, M[MAX][MAX];

int prim() {
  int u, minv;
  int d[MAX], p[MAX], color[MAX];

  REP(i, n) {
    d[i] = INFTY;
    p[i] = -1;
    color[i] = white;
  }

  d[0] = 0;

  while( 1 ) {
    minv = INFTY;
    u = -1;
    REP(i, n) {
      if (minv > d[i] && color[i] != black ) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) break;
    color[u] = black;
    REP(v, n) {
      if (color[v] != black && M[u][v] != INFTY) {
        if (d[v] > M[u][v]) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = gray;
        }
      }
    }
  }
  int sum = 0;
  REP(i, n) {
    if (p[i] != -1) sum += M[i][p[i]];
  }
  return sum;
}

int main() {
  cin >> n;
  REP(i, n) {
    REP(j, n) {
      int e;
      cin >> e;
      M[i][j] = (e == -1) ? INFTY : e;
    }
  }
  cout << prim() << endl;
  return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,k;
ll ans=0;
int main(){
	cin>>n>>k;
	if(k==0){
		cout<<n*n<<endl;
		return 0;
	}
	for(ll i=k+1;i<=n;++i){
		ll leiluo=n/i;
		ans+=(leiluo)*(i-k);
		if(n%i>=k)
			ans+=(n%i-k+1);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

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

    if(((x-r)<0 || (x+r)>W)||((y-r)<0 ||(y+r)>H)){
            printf("No\n");
    }
    else
    {
        printf("Yes\n");
    }

    return 0;
}

Measured memory_bytes: 1012
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;
using P = pair<int, int>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const double PI = acos(-1);
// }}} End Header
struct edge{
	int to;
	int cost;
};
int main() {
	ll n, ans=1;
	cin >> n;
	vector<ll> a(n);
	rep(i,n){
		cin >> a[i];
		if(a[i] == 0){
			cout << 0 << endl;
			return 0;
		}
	}
	rep(i,n){
		if(a[i] > (1000000000000000000/ans)){
			cout << -1 << endl;
			return 0;
		}
		ans*=a[i];
	}
	cout << ans << endl;
 	return 0;
}

Measured memory_bytes: 3968
#include <stdio.h>
long long lunlun[100000];
int main() {
	int k;
	long long num = 0, bottom = 9, top = 0;
	scanf("%d", &k);
	for (int i = 1; i < 10; i++) {
		lunlun[i - 1] = i;
	}
	if (k < 10) {
		printf("%d\n", lunlun[k - 1]);
	} else {
		while (1) {
			for (int j = -1; j <= 1; j++) {
				if (lunlun[top] % 10 + j == -1 || lunlun[top] % 10 + j == 10)
					continue;
				lunlun[bottom] = lunlun[top] * 10 + lunlun[top] % 10 + j;
				bottom++;
				if (bottom == k) break;
			}
			top++;
			if (bottom == k) break;
		}
		printf("%lld\n", lunlun[k - 1]);
	}
	return 0;
}

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

using namespace std;
typedef long long LL;

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> S(H+2);
  rep(i,H){
    string s;
    cin >> s;
    S[i+1]='.'+s+'.';
  }
  rep(i,W) S[0].push_back('.'), S[H+1].push_back('.');
  int dx[8]={0,0,1,1,1,-1,-1,-1};
  int dy[8]={1,-1,0,1,-1,0,1,-1};
  vector<string> ans(H);
  rep(i,H){
    rep(j,W){
      if(S[i+1][j+1]=='#'){
        ans[i].push_back('#');
        continue;
      }
      int num=0;
      rep(k,8) if(S[i+1+dx[k]][j+1+dy[k]]=='#') num++;
      ans[i]+=to_string(num);
    }
  }
  rep(i,H) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**5+1)
n = int(input())
if n==1:
  print(0)
  exit()
from collections import defaultdict
edge = defaultdict(list)
for i in range(n-1):
  u, v, w = list(map(int, input().split()))
  edge[u].append((v, w))
  edge[v].append((u, w))
graph = [-1 for i in range(n+1)]

def dfs(x, c):
  nexts = edge.get(x)
  if nexts is None:
    return
  if graph[x]!=-1:
    return
  else:
    graph[x] = c
  for y, w in nexts:
    if w%2:
      dfs(y, not c)
    else:
      dfs(y, c)

dfs(1, 0)
for i in range(1, n+1):
  print(int(graph[i]))

Measured memory_bytes: 159704
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    int n, c[4] = {0, 3, 5, 7}, ans = 0;
    vector<int> v;
    cin >> n;
    for(int i=1;i<(1<<18);i++){
        int x = 0;
        for(int j=0, k=1, l=1;j<9;j++,k*=4,l*=10){
            x += c[(i / k) % 4] * l;
        }
        v.push_back(x);
    }
    for(int i=0;i<v.size();i++){
        int t = v[i];
        bool f[3];
        f[0] = f[1] = f[2] = false;
        if(t <= n){
            while(t > 0){
                int u = t % 10;
                if(u == 3 || u == 5 || u == 7)f[(u-3)/2] = true;
                else break;
                t /= 10;
            }
            if(t == 0 && f[0] && f[1] && f[2]){
                ans++;
                //cout << v[i] << endl;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  int ans = 0;

  for (int bit = 0; bit < (1<<h); bit++) {
    vector<int> H(6);
    for (int i = 0; i < h; i++) {
      if(bit & (1<<i)) H[i] = 1;
    }
    for (int bits = 0; bits < (1<<w); bits++){
      vi W(6);
      for (int j = 0; j < w; j++) {
        if (bits & (1<<j)) W[j] = 1;
      }
      int cnt = 0;
      rep(x, h) rep(y, w) {
        if (H[x] || W[y]) continue;
        if (s[x][y] == '#') cnt++;
      }
      if (cnt == k) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n,a;
	cin >> n >> a;
	int n1,n2,n3;
	for(int i=a-n+1;i<a+n-1;i++){
		cout << i << " ";
	}
	cout << a+n-1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int main() {
    cin >> n;
    int b;
    cin >> b;
    a.push_back(b);
    for (int i = 1; i < n; i++)
    {
        cin >> b;
        if(b > a[a.size()-1]) a.push_back(b);
        else{
            auto c = lower_bound(a.begin(), a.end(), b);
            a[c - a.begin()] = b;
        }
    }

    cout << a.size() << endl;
}


Measured memory_bytes: 3436
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

main(){
	int n,w;cin>>n>>w;vint v[4];
	int t;
	rep(i,n){
		int p,q;cin>>p>>q;
		if(i==0)t=p;
		v[p-t].pb(q);
	}
	rep(i,4){
		
		sort(all(v[i]));
		v[i].pb(0);
		rev(all(v[i]));
		for(int j=1;j<v[i].size();j++){
			v[i][j]+=v[i][j-1];
		}
	}
	hi;
	int ans=0;
	rep(i,v[0].size()){
		rep(j,v[1].size()){
			rep(k,v[2].size()){
				rep(l,v[3].size()){
					if((t*i+(t+1)*j+(t+2)*k+(t+3)*l)<=w){
						ans=max(ans,v[0][i]+v[1][j]+v[2][k]+v[3][l]);
					}
				}
			}
		}
	}
	dans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    int x = 0;
    rep(i, n) {
        if(s[i] == 'I') x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n;
    int b, f, r, v;
    int a[4][3][10]={0};
    scanf("%d", &n);

    for (int i = 0; i < n; i++)
    {
        scanf("%d %d %d %d", &b, &f, &r, &v);
        a[b-1][f-1][r-1]=a[b-1][f-1][r-1]+v;
    }
    for (int j = 0; j < 4; j++)
    {
        for (int k = 0; k < 3; k++)
        {
            for (int l = 0; l < 10; l++)
            {
                printf(" %d",a[j][k][l]);
            }
            printf("\n");
        }
        if (j!=3)
        {
        printf("####################\n");
        }
        
        
    }
    

}


Measured memory_bytes: 2108
#include <stdio.h>
#include <algorithm>
using namespace std;
#define N (200010)
int n, a[N<<1], b[N<<1];
int main(){
    scanf("%d", &n);
    int ans = 0;
    for (int i = 1; i <= n; ++i){
        scanf("%d", a+i);
        b[a[i]] = b[a[i]-1]+1;
        ans = max(ans, b[a[i]]);
    }
    printf("%d\n", n-ans);
}

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

int main() {
    int a[4];rep(i,4)cin>>a[i];
    
    cout<<a[2]+(a[1]-a[3])<<" "<<a[3]+(a[2]-a[0])<<" "<<a[0]+(a[1]-a[3])<<" "<<a[1]+(a[2]-a[0])<<endl;
	return 0;
}

Measured memory_bytes: 3628