akhauriyash/Code-Regression huggingface dataset:
//すぬけさんAC
//https://www.youtube.com/watch?v=Kjk26wgMSQ8&feature=youtu.be

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
// const ll INF = 1000000000000000000LL;

int main() {
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	rep(ki,k){
		vector<int> b(n+1);
		rep(i,n){
			int l = max(0,i-a[i]);
			int r = min(i+a[i]+1,n);
			b[l]++;b[r]--;
		}
		rep(i,n) b[i+1] += b[i];
		b.pop_back();
		if(a==b) break;
		a = b;
	}
	rep(i,n) cout << a[i] << endl;
	return 0;
}



Measured memory_bytes: 4820
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll nums[100009];

void no(){
    cout1(-1)
    exit(0);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    rep(i,N) cin>>nums[i];
    reverse(nums,nums+N);
    ll mn=2,mx=2;
    
    rep(i,N){
        ll x=nums[i],n;
        if(mn%x) n=(mn/x+1)*x;
        else n=max(n,mn);
        if(n<mn||n>mx) no();
        mn=n,mx=(mx/x+1)*x-1;
    }
    cout2(mn,mx)
}

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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define ll unsigned long long
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

const int Maxn = (int)1e6 + 1;
const ld pi = acos(-1);
const int mod = (int)1e9 + 7;
const int inf = (int)1e18;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
    fr(i, 0, (int)A.size()) out << A[i] << " ";
    return out;
}

vector<int> factor(Maxn, 0);

bool sieve(vector<int> &A, int n){
    for(int i=2;i<=Maxn;i++){
        int cnt = 0;
        for(int j=i;j<=Maxn;j+=i)
            cnt += factor[j];
        if(cnt > 1) return false;
    }
    return true;
}

bool setwise_coprime(vector<int> &A, int n){
    int result = A[0];
    fr(i,1,n)   result = __gcd(result, A[i]);
    return (result == 1);
}

int32_t main() {
    IOS int n;  cin>>n;
    vector<int> A(n);   fr(i,0,n){
        cin>>A[i];
        factor[A[i]]++;
    }
    if(sieve(A, n))
        cout << "pairwise coprime" << endl;
    else if(setwise_coprime(A,n))
        cout << "setwise coprime" << endl;
    else 
        cout << "not coprime" << endl;
    return 0;
}


Measured memory_bytes: 18732
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
	int y,m,d,x;
	while (cin >> y >> m >> d){
		x = y * 10000 + m * 100 + d;
		if (x < 18680908) cout << "pre-meiji\n";
		else if (x < 19120730) printf("meiji %d %d %d\n", y - 1867, m,d);
		else if (x < 19261225) printf("taisho %d %d %d\n", y - 1911, m, d);
		else if (x < 19890108) printf("showa %d %d %d\n", y - 1925, m, d);
		else printf("heisei %d %d %d\n", y - 1988, m, d);
	}
}

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

const ll mod = (ll) 1e9 +7;

ll dp[1005][1005];
char s[1005][1005];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int w,h;
	cin>>w>>h;
	
	for(int i=0;i<w;i++)
	for(int j=0;j<h;j++)
	cin>>s[i][j];
	
	dp[0][1] = 1;
	
	for(int i=1;i<=w;i++)
	{
		for(int j=1;j<=h;j++)
		{
			if(s[i-1][j-1]=='.')
			dp[i][j] = (dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;
			
			else
			dp[i][j] = 0;
		}
	}
	
	cout<<dp[w][h]<<"\n";
	return 0;
}

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

int A, B, ans;

void solve() {
    cin >> A >> B;
    if(2*B >= A) ans = 0;
    else ans = A - 2*B;
    cout << ans << endl;
    return; 
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c;
int ans = 1000000;
int l[100] = {0};
void dfs(int cost, int i, int la, int lb, int lc){
    if(i == n) {
        if(la*lb*lc > 0){
            cost += abs(a-la) + abs(b-lb) + abs(c-lc);
            ans = min (ans, cost);
        }
    }
    else{
        dfs(cost,i+1,la,lb,lc);
        dfs(cost + 10*(la!=0),i+1,la + l[i],lb,lc);
        dfs(cost + 10*(lb!=0),i+1,la,lb + l[i],lc);
        dfs(cost + 10*(lc!=0),i+1,la,lb,lc + l[i]);
    }
}

int main(){
    cin >> n >> a >>b >>c;
    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
    }
    dfs(0,0,0,0,0);
    cout << ans << endl;
    

}

Measured memory_bytes: 3608
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		char[] s = sc.next().toCharArray();
		sc.close();
		HashSet<Integer> l = new HashSet<>(); 
		HashSet<Integer> r = new HashSet<>(); 
		int mx = 0;
		for (i = 1; i < n; i++) {
			for (j = 0; j < n; j++) {
				if(j<i) {
					l.add(s[j]-'0');
				} else {
					r.add(s[j]-'0');
				}
			}
			l.retainAll(r);
			if(mx < l.size()) mx = l.size();
			l.clear();
			r.clear();
		}
		out.println(mx);
	}
}


Measured memory_bytes: 23892
#include <stdio.h>
int main(){
  int n,i,R[200000],max,min;
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&R[i]);
  }
  min = R[0];
  max = R[1] - R[0];
  for(i = 1; i < n; i++){
    if(max < R[i] - min){
      max = R[i] - min;
    }
    if(min > R[i]){
      min = R[i];
    }
  }
  printf("%d\n",max);
  return 0;
}

Measured memory_bytes: 1376
S = input()
T = input()
C = [-1]*26
for k in range(len(S)):
    if C[ord(T[k])-97] == -1:
        if ord(S[k])-97 in C:
            print("No")
            exit(0)
        else:
            C[ord(T[k])-97] = ord(S[k])-97
    else:
        if C[ord(T[k])-97] != ord(S[k])-97:
            print("No")
            exit(0)

print("Yes")


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

int main()
{
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (auto&& e : s) cin >> e;
  vector<vector<int>> grid(h + 2, vector<int>(w + 2));

  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      if (s[y][x] == '#') {
        grid[y + 1][x + 1] = -1;
      }
    }
  }

  for (int y = 1; y <= h; y++) {
    for (int x = 1; x <= w; x++) {
      if (grid[y][x] != 0) continue;
      int cnt = 0;
      for (int dy = -1; dy <= 1; dy++) {
        for (int dx = -1; dx <= 1; dx++) {
          if (grid[y + dy][x + dx] < 0) cnt++;
        }
      }
      grid[y][x] = cnt;
    }
  }

  for (int y = 1; y <= h; y++) {
    for (int x = 1; x <= w; x++) {
      if (grid[y][x] < 0) {
        cout << '#';
      } else {
        cout << grid[y][x];
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
int left[4],right[4];
int main(){
	double a,b;
	while(~scanf("%lf%lf",&a,&b)){
		if(a<0.2)left[3]++;
		else if(a<0.6)left[2]++;
		else if(a<1.1)left[1]++;
		else left[0]++;
		if(b<0.2)right[3]++;
		else if(b<0.6)right[2]++;
		else if(b<1.1)right[1]++;
		else right[0]++;
	}
	for(int i=0;i<4;i++)printf("%d %d\n",left[i],right[i]);
}


Measured memory_bytes: 2600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e12;
ll mod=1e9+7;
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
vector<int> graph[205];
int color[205];
int nCk[100][100];
bool bipartite_jugding(int v, int c){
    color[v] = c;
    for(int i = 0; i < graph[v].size(); ++i){
        if(color[graph[v][i]] == c) return false;
        if(color[graph[v][i]] == 0 && !bipartite_jugding(graph[v][i], -c)){
            return false;
        }
    }
    return true;
}

 void combi() {
	for (int i = 0; i <= 99; ++i) nCk[i][0] = 1;
	for (int i = 1; i <= 99; ++i) for (int j = 1; j <= i; ++j) {
		nCk[i][j] = (nCk[i-1][j] + nCk[i-1][j-1]) % mod;
	}
}

long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}
int h,w;
 vector<vector<char> > mat(20,vector<char> (20));
int X[]={0,1,0,-1};
int Y[]={-1,0,1,0};
bool valid(int x,int y){
    if(x>=0 && x<h && y>=0 && y<w && mat[x][y]!='#')return true;
    return false;}
vector<vector<int> > visi(21,vector<int> (21));
int moves(int x1,int y1,int x2,int y2)
{
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
        visi[i][j]=0;
    queue<pair<int,int> > q;
    q.push({x1,y1});int level=1;int ans=0;
    while(q.size())
    {
    x1=q.front().fi;y1=q.front().se;level--;q.pop();
    if(x1==x2 && y1== y2)return ans;
    visi[x1][y1]=1;
    for(int i=0;i<4;i++)
    {
            if(valid(x1+X[i],y1+Y[i]) && !visi[x1+X[i]][y1+Y[i]])
            q.push({x1+X[i],y1+Y[i]});

    }
    if(level==0)
    {
        ans++;
        level=q.size();
    }
    }
    return -1;
}

void solve(){
    boost;
  cin>>h>>w;int c=0;
  for(int i=0;i<h;i++)
      for(int j=0;j<w;j++){
        cin>>mat[i][j];if(mat[i][j]=='#')c++;}
    if(c==0 && h==w){cout<<2*(h-1);return ;}
    int ans=0;
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
             for(int i1=0;i1<h;i1++)
    for(int j1=0;j1<w;j1++){ int k=-1;
    if(mat[i][j]=='.' && mat[i1][j1]=='.')
        k=moves(i,j,i1,j1);
        if(k!=-1)ans=max(ans,k);}
  cout<<ans<<endl;
}

int main(){
    boost;
  solve();
}


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



main(){
  
  
  int n,i,j,a;
  
int A[N];
  


  scanf("%d",&n);
  
  for(i = 1; i < n; i++){
    
    scanf("%d %d",&A[i],&a);
      
  }
  scanf("%d %d",&A[i],&A[i+1]);



  Matrix(A,n+2);

  return 0;
  
}

int Matrix(int p[N],int x)
{
  
  int n,i,j,l,k,q;
  int B[N][N];
  
  n = x - 1;
  
  for(i = 1; i <= n; i++){
    B[i][i] = 0;
  }
  
  for(l = 2; l <= n; l++){
    for(i = 1; i <= n-l+1; i++){
      
      j = i+l-1;
      B[i][j] = INT_MAX; 
      
      for(k = i; k <= j-1; k++){
	q = B[i][k] + B[k+1][j] + p[i-1]*p[k]*p[j];
	B[i][j] = min(B[i][j],q);
      }
    }
  }

  printf("%d\n",B[i][j]);
}

int min(int x,int y){

  if(x <= y){
    return x;
  }
  else {
    return y;
  }
}

Measured memory_bytes: 656
#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let n: usize = scn.read();
        let mut a: Vec<_> = (0..n)
            .map(|i| {
                let x: i64 = scn.read();
                let y: i64 = scn.read();
                (x, y)
            })
            .collect();
        a.sort();

        let mut b: Vec<_> = a.iter().map(|(x, y)| x + y).collect();
        let mut c: Vec<_> = a.iter().map(|(x, y)| x - y).collect();
        b.sort();
        c.sort();

        let mut result = b[n - 1] - b[0];
        result = std::cmp::max(result, c[n - 1] - c[0]);
        println!("{}", result);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 7908
#include "bits/stdc++.h"
using namespace std;

int64_t L(int64_t l) {
	if (l==0)
	{
		return 2;
	}
	if (l==1)
	{
		return 1;
	}
	int64_t tmp0 = 2;
	int64_t tmp1 = 1;
	int64_t tmp2 = 0;
	for (size_t i = 0; i < l; i++)
	{
		 tmp2 = tmp1 + tmp0;
		 tmp0 = tmp1;
		 tmp1 = tmp2;
	}
	return tmp0;
}

int main() {
	int64_t N = 0;

	cin >> N;

	cout << L(N) << "\n";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    int x, y, tmp;
    cin >> x >> y;
    if (y > x) {
        tmp = x;
        x = y;
        y = tmp;
    }
    while (x%y!=0) {
        tmp = x;
        x = y;
        y = tmp % x;
    }
    cout << y << endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int MOD = 1e9 + 7;

ll N,M,K,H,W;

int main(){
	string s, t;
	cin >> s >> t;
	cout << t + s;
	return 0;
}




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

int f(int x){
    int ans=0,min=x;
    while(min>0){
        ans+=min%10;
        min=min/10;
    }
    return ans;   
}

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    int ans=0,sub;

    for(int i=1;i<=n;i++){
        sub=f(i);
        if(sub>=a&&sub<=b){
            ans+=i;
        }
    }
    cout << ans;
    return 0;
}

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

#define ll long long

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll n;
    cin>>n;
    ll stones[n+1],x=0;
    for(int i=1;i<=n;i++){
    	cin>>stones[i];
    	if(i>2)
    		x=(x^stones[i]);
	}
	ll s=stones[1]+stones[2]-x;
	ll d=stones[1];
	if(s%2==1||s<0){
		cout<<-1<<endl;
		return 0;
	} 
	s/=2;
	if((s&x)>0||s>d){
		cout<<-1<<endl;
		return 0;
	}
	stones[1]=stones[2]=s;
	for(int i=40;i>=0;i--){
		ll p=(1LL<<i);
		if((p&x)>0){
			if(stones[1]+p>d)
				stones[2]+=p;
			else
				stones[1]+=p;
		}
	}
	ll ans;
	if(stones[1]==0)
		ans=-1;
	else
		ans=d-stones[1];
	cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

vector<int> demical(ll n,int k,int l){
    vector<int> rtn(l);
    REP(i,l){
        rtn[i]=n%k;
        n/=k;
    }
    //while(n>0){
    //rtn.push_back(n%k);
    //n/=k;
    //}
    return rtn;
}

int main(){
    int d,g;
    cin >> d >> g;
    vector<int> p(d);
    vector<int> c(d);
    REP(i,d){
        cin >> p[i] >> c[i];
    }
    int m = pow(2,d);
    int res = INT_MAX;
    REP(i,m){
        vector<int> dem = demical(i, 2, d);
        int cnt = 0;
        int sum = 0;
        REP(j,d){
            if(dem[j]==1){
                cnt += p[j];
                sum += p[j]*(j+1)*100;
                sum += c[j];
            }
        }
        int v = g-sum;
        if(v<=0){
            chmin(res,cnt);
        }else{
            RREP(j,d){
                if(dem[j]==0){
                    if((v+(j+1)*100-1)/((j+1)*100)<p[j]){
                        cnt += (v+(j+1)*100-1)/((j+1)*100);
                        chmin(res,cnt);
                        break;
                    }
                }
            }
            //chmin(res,cnt);
        }
        
    }
    put(res);
    return 0;
}


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

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

    int h = S / 3600;
    int m = (S - h * 3600) / 60;
    int s = S - h * 3600 - m * 60;

    cout << h << ":" << m << ":" << s << endl;
    return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll dp[105][5][5][5][5];
int n;
string x;
map<char,int>mp;
int valid(int a,int b,int c,int d)
{
    int num=0;
    num+=a;
    num*=10;
    num+=b;
    num*=10;
    num+=c;
    num*=10;
    num+=d;
    if(num==123 || num==132 || num==213 || num==1423 || num==1243 ||
       num==1223 || num==1323)
        return -1;
    num=0;
    num+=b;
    num*=10;
    num+=c;
    num*=10;
    num+=d;
    if(num==123 || num==132 || num==213)
        return -1;
    if(num<100)
        return 0;
    return 1;
}
ll recur(int pos,int a,int b,int c,int d)
{
    if(valid(a,b,c,d)==-1){
     //   cout<<x[a-1]<<" "<<x[b-1]<<" "<<x[c-1]<<" "<<x[d-1]<<endl;
        return 0;
    }
    if(pos==n)
    {
        if(valid(a,b,c,d)==1){


            return 1;
        }
        return 0;
    }
    ll &ret=dp[pos][a][b][c][d];
    if(~ret)
        return ret;
    ret=0;
    for(int i=0; i<4; i++)
    {
        ret=(ret+recur(pos+1,b,c,d,mp[x[i]]))%MOD;
    }
    return ret;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    memset(dp,-1,sizeof(dp));
    x="AGCT";
    cin>>n;
    mp['A']=1;
    mp['G']=2;
    mp['C']=3;
    mp['T']=4;
    cout<<recur(0,0,0,0,0)<<endl;


    return 0;
}


Measured memory_bytes: 4140
/*بسم الله الرحمن الرحيم*/
/*“Dengan menyebut nama Allah yang Maha Pengasih lagi Maha Penyayang”*/
/*“In the name of Allah, Most Gracious, Most Merciful”*/
/********************************************************************************************************\__
                                                                                                          |
        author  :   Althafa Dhia Syauqi   ||    email   :    daltafa@gmail.com                              ||
        SMAN 10 Samarinda, Kalimantan Timur.                                                    ||
                                                                                                          ||
/********************************************************************************************************/
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define rep_k(i,n) for(int x=i;x<n;x++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_n(i,n) for(int i=1;i<=(n);i++)
#define rep_all(k) for(auto x:k)
#define endl '\n'
#define mod 1e9+7
#define pb push_back
#define READ(f)         freopen(f, "r", stdin)
#define WRITE(f)        freopen(f, "w", stdout)
#define maxSort         sort(all(v),greater<int>())
#define rSort           sort(v.rbegin(),v.rend())
#define FOREACH(i,c) for (typeof((c).end()) i = (c).begin(); i != (c).end(); ++i)
#define RESET(c,v) memset(c, v, sizeof(c))
#define sqr(x)          ((x)*(x))
#define qube(x)         ((x)*(x)*(x))
using namespace std;
void optimization()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
ll n,m,c,b[20],a,ans=0,jawab=0;
int main()
{
	optimization();
	cin >> n>>m>>c;
	rep(i,m)
		cin >> b[i];
	rep(i,n)
	{
			rep(k,m)
			{
				cin >> a;
				jawab+=a*b[k];
			}
		jawab+=c;
		if(jawab>0)
			ans++;
		jawab=0;
	}
	cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define R register
typedef long long i64;
namespace IO{
	char buf[1<<15],*S,*T;
	inline char gc(){
		if (S==T){
			T=(S=buf)+fread(buf,1,1<<15,stdin);
			if (S==T) return EOF;
		}return *S++;
	}
	inline int read(){
		R int x; R bool f; R char c;
		for (f=0; (c=gc())<'0'||c>'9'; f=c=='-');
		for (x=c^'0'; (c=gc())>='0'&&c<='9'; x=(x<<1)+(x<<3)+(c^'0'));
		return f?-x:x;
	}
}
#define MN 100005
int n,l[MN],r[MN],lrk[MN],rrk[MN],cnt,pos,ll,rr;bool vis[MN],op;i64 ans,ans2;
inline bool cmp1(int a,int b){return r[a]<r[b];}
inline bool cmp2(int a,int b){return l[a]>l[b];}
int main(){
	n=IO::read();for (R int i=1; i<=n; ++i)
		l[i]=IO::read(),r[i]=IO::read(),lrk[i]=rrk[i]=i;
	std::sort(lrk+1,lrk+n+1,cmp2);std::sort(rrk+1,rrk+n+1,cmp1);
	for (memset(vis,0,sizeof vis),cnt=op=pos=0,ll=1,rr=1; cnt<n; ++cnt,op^=1){
		if (op){
			while(vis[lrk[ll]]) ++ll;vis[lrk[ll]]=1;
			if (pos<l[lrk[ll]]) ans+=l[lrk[ll]]-pos,pos=l[lrk[ll]];
			else if (pos>r[lrk[ll]]) ans+=pos-r[lrk[ll]],pos=r[lrk[ll]];
		}else{
			while(vis[rrk[rr]]) ++rr;vis[rrk[rr]]=1;
			if (pos<l[rrk[rr]]) ans+=l[rrk[rr]]-pos,pos=l[rrk[rr]];
			else if (pos>r[rrk[rr]]) ans+=pos-r[rrk[rr]],pos=r[rrk[rr]];
		}
	}
	ans+=pos<0?-pos:pos;
	for (memset(vis,0,sizeof vis),op=1,cnt=pos=0,ll=1,rr=1; cnt<n; ++cnt,op^=1){
		if (op){
			while(vis[lrk[ll]]) ++ll;vis[lrk[ll]]=1;
			if (pos<l[lrk[ll]]) ans2+=l[lrk[ll]]-pos,pos=l[lrk[ll]];
			else if (pos>r[lrk[ll]]) ans2+=pos-r[lrk[ll]],pos=r[lrk[ll]];
		}else{
			while(vis[rrk[rr]]) ++rr;vis[rrk[rr]]=1;
			if (pos<l[rrk[rr]]) ans2+=l[rrk[rr]]-pos,pos=l[rrk[rr]];
			else if (pos>r[rrk[rr]]) ans2+=pos-r[rrk[rr]],pos=r[rrk[rr]];
		}
	}
	ans2+=pos<0?-pos:pos;
	ans=ans2>ans?ans2:ans;
	printf("%lld\n",ans);
}

Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
    double a, b, C;
    cin >> a >> b >> C;
    C = C * M_PI / 180;
    double S, L, h;
    h = b * sin(C);
    L = a + b + sqrt(a * a + b * b - 2 * a * b * cos(C));
    S = a * h / 2;
    printf("%.5f\n%.5f\n%.5f\n", S, L, h);
}



Measured memory_bytes: 3540
#include <stdio.h>
#include <stdlib.h>

int main() {
	int N, K;
	int x[100];
	int i;
	int move_count;

	scanf("%d", &N);
	scanf("%d", &K);

	for (i=1; i<=N; i++) {
		scanf("%d", &x[i]);
	}

	move_count = 0;
	for (i=1; i<=N; i++) {
		if(abs(x[i]-0) < abs(K-x[i])) {
			move_count = move_count + abs(x[i]-0) *  2;
		} else {
			move_count = move_count + abs(K-x[i]) *  2;
		}
	}

	printf("%d\n", move_count);
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int,input().split()))
ans = [0]
for i in range(N):
  if i%2==0:
    ans[0] += A[i]
  else:
    ans[0] -= A[i]
for i in range(N-1):
  ans.append(2*(A[i] - ans[i]//2))
print(*ans)

Measured memory_bytes: 20612
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class Main {

    private static PrintWriter out;

    private static <T> void mprintln(T... ar) {
        for (T i : ar) {
            out.print(i + " ");
        }
        out.println();
    }

    public static void main(String[] args) throws FileNotFoundException {

        // Input from file
        // File inputFile = new File("JavaFile.txt");
        // File outputFile = new File("JavaOutputFile.txt");
        // FileReader fileReader = new FileReader(inputFile);
        // Here it ends

        MyScanner sc = new MyScanner();
        // MyScanner sc = new MyScanner(fileReader);

        out = new PrintWriter(new BufferedOutputStream(System.out)); // Output to console
        // out = new PrintWriter(new PrintStream(outputFile)); // Output to file

        getAns(sc);

        out.close();
    }

    /*
     *Don't use builtin function (Math.ceil)
     */

    static final long MOD = (long) (1e9 + 7);

    private static void getAns(MyScanner sc) {
        int a = sc.ni();
        String s = sc.nn();

        out.println(a < 3200? "red": s);
    }

    static class MyScanner {

        BufferedReader br;
        StringTokenizer st;

        MyScanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }

        MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nn() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }

        char nc() {
            return nn().charAt(0);
        }

        int ni() {
            return Integer.parseInt(nn());
        }

        long nl() {
            return Long.parseLong(nn());
        }

        double nd() {
            return Double.parseDouble(nn());
        }

        int[] niArr0(int n) {
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) {
                ar[i] = ni();
            }
            return ar;
        }

        int[] niArr1(int n) {
            int[] ar = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = ni();
            }
            return ar;
        }

        long[] nlArr0(int n) {
            long[] ar = new long[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nl();
            }
            return ar;
        }

        long[] nlArr1(int n) {
            long[] ar = new long[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nl();
            }
            return ar;
        }
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265358979
#define MOD 998244353
const int MAX = 510000;

int main() {
  ll N;cin>>N;
  vector<ll>a(N);
  vector<ll>b(N);
  rep(i,N){
  	cin>>a[i];
  	b[a[i]-1ll]=i;
  }
  set<ll> s;
  s.insert(-1ll);
  s.insert(N);
  ll ans=0;
  rep(i,N){
    s.insert(b[i]);
    auto t=s.lower_bound(b[i]);
    t--;
    auto mi=*t;
    t++;t++;
    auto ma=*t;
    ans+=(i+1ll)*(ma-b[i])*(b[i]-mi);
  }
  cout<<ans;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<string> A(n), B(m);
  auto solve = [&]() -> bool {
    REP(i, n) { cin >> A[i]; }
    REP(i, m) { cin >> B[i]; }
    REP(r, n - m + 1) {
      REP(c, n - m + 1) {
        REP(i, m) REP(j, m) {
          if (B[i][j] != A[r + i][c + j]) {
            goto no_match;
          }
        }
        return true;
      no_match:
        continue;
      }
    }
    return false;
  };
  cout << (solve() ? "Yes\n" : "No\n");
}


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

memo = {0: 1}
for i in range(n):
    if d[i] not in memo:
        memo[d[i]] = 1
    else:
        memo[d[i]] += 1

used = [] * n
li = []
for i in memo:
    if memo[i] >= 3:
        print(0)
        exit()
    elif memo[i] == 2:
        used.append(i)
        used.append(24 - i)
    else:
        li.append(i)

ans = 0
for bit_state in range(1 << len(li)):
    tmp = used[0:]
    for i in range(len(li)):
        if bit_state & (1 << i):
            tmp.append(li[i])
        else:
            tmp.append(24 - li[i])
    tmp = sorted(tmp)
    diff = 10 ** 18
    for i in range(1, len(tmp)):
        diff = min(diff, tmp[i] - tmp[i - 1])
    diff = min(diff, 24 - (tmp[-1] - tmp[0]))
    ans = max(ans, diff)
print(ans)

Measured memory_bytes: 41456
import java.util.Scanner;

public class Main {

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

        sc.close();

        if (d == 25) {
            System.out.println("Christmas");
        } else if (d == 24) {
            System.out.println("Christmas Eve");
        } else if (d == 23) {
            System.out.println("Christmas Eve Eve");
        } else {
            System.out.println("Christmas Eve Eve Eve");
        }

    }
}

Measured memory_bytes: 21588
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();

        if(S.equals("ABC")) {
            S = "ARC";
        } else {
            S = "ABC";
        }
        System.out.println(S);
    }
}


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

int main()
{


    int n,k;
    cin>>n>>k;
    long long arr[200009];
    for(int i=0;i<n;++i)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    long long sum=0;
    for(int i=0;i<n-k;++i)
    {
        sum+=arr[i];
    }
    cout<<sum;

    return 0;
}


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

int main() {
	string S;
	cin >> S;
	stack<char> tmp;
	for (size_t i = 0; i < S.size(); ++i) {
		if (tmp.empty()) {
			tmp.push(S[i]);
		}
		else {
			if (S[i] == '0') {
				if (tmp.top() == '0') {
					tmp.push(S[i]);
				}
				else {
					tmp.pop();
				}
			}
			else {
				if (tmp.top() == '0') {
					tmp.pop();
				}
				else {
					tmp.push(S[i]);
				}
			}
		}
	}
	cout << S.size() - tmp.size();
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
		int N;
	cin >> N;
	pairs(K)
	fx(N) {
		pairsp(K);
	}
	sorts(K);
	ce(K[N-1].first+K[N-1].second)
	
    return 0;
}



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

int main()
{
  int n,m;cin>>n>>m;
  char arr[n][m];
  for(int i=0;i<n;i++)
  {
  	for(int j=0;j<m;j++)
  	{
  		cin>>arr[i][j];
  	}
  }
  ll dp[n][m];
  for(int i=0;i<m;i++)
  { if(arr[0][i]!='#')
  	dp[0][i]=1;
  	else{
  	dp[0][i]=0;int ind=i+1;
  	for(int j=ind;j<m;j++)
  {
  	dp[0][j]=0;
  }
  	
  	break;}
  }
  
  for(int i=0;i<n;i++)
  { if(arr[i][0]!='#')
  	dp[i][0]=1;
  	else{
  	dp[i][0]=0;int indo=i+1;
  	for(int j=indo;j<n;j++)
  {
  	dp[j][0]=0;
  }
  	break;}
  }
  
  for(int i=1;i<n;i++)
  {
  	for(int j=1;j<m;j++)
  	{
  		if(arr[i][j]=='#')
  		{
  			dp[i][j]=0;continue;
  		}
  		else
  		{
  			dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
  		}
  	}
  }
  
  cout<<dp[n-1][m-1];
  return 0;
}


Measured memory_bytes: 12212
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
    while(1){
        string s;
        cin >> s;
        if(s == "-") break;

        int m;
        cin >> m;
        for(int i=0; i<m; i++){
            int h;
            cin >> h;
            string sub = s.substr(0, h);
            s.erase(s.begin(), s.begin() +h);
            s += sub;
        }
        cout << s << endl;
    }
    return 0;
}


Measured memory_bytes: 3156
from bisect import bisect_left, bisect_right

N = int(input())

A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0
for i in range(N):
  len_a = bisect_left(A, B[i])
  c_index = bisect_right(C, B[i])
  len_c = N - c_index
  ans += len_a * len_c
print(ans)

Measured memory_bytes: 23232
def main():
    n = int(input())
    a = list(map(int,input().split()))
    flg = 0
    for i, aa in enumerate(a):
        if aa % 2 == 0:
            if aa % 3 ==0 or aa % 5 == 0:
                continue
            else:
                flg = 1
    if flg == 0:
        print('APPROVED')
    else:
        print('DENIED')
if __name__=='__main__':
    main()


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

int main() {
	int n;
	cin >> n;
	int a[n],b[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	
	for(int i=0;i<n;i++){
		b[a[i]-1] = i+1;
	}
	
	for(int i=0;i<n;i++){
		cout << b[i] << " ";
	}
	cout << endl;
	
	return 0;
}

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

using ll = long long;
const ll mod = 998244353;


ll dp[3030][3030][3];
int a[3030];
int main(){
    int n, k;
    cin >> n >> k;
    for(int i=0;i<n;i++)cin >> a[i];
    dp[0][0][0] = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<=k;j++){
            (dp[i+1][j][0] += dp[i][j][0]) %= mod;
            (dp[i+1][j][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
            (dp[i+1][j][2] += dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) %= mod;
            if(j + a[i] <= k){
                (dp[i+1][j+a[i]][1] += dp[i][j][0] + dp[i][j][1]) %= mod;
                (dp[i+1][j+a[i]][2] += dp[i][j][0] + dp[i][j][1]) %= mod;
            }
        }
    }
    cout << dp[n][k][2] << endl;
}


Measured memory_bytes: 215168
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;



int main() {
	ios::sync_with_stdio(false);
	cin >> W >> H;
	while (H) {
		ans = 0;
		string s[30];
		for (int i = 1; i <= H; i++) {
			cin >> s[i];
			s[i] = '#' + s[i] + '#';
		}
		for (int i = 0; i <= W + 1; i++) {
			s[0].push_back('#');
			s[H + 1].push_back('#');
		}
		int dir[5] = { 1,0,-1,0,1 };
		queue<pair<int, int> >Q;
		for (int i = 1; i <= H; i++) {
			for (int j = 1; j <= W; j++) {
				if (s[i][j] == '@') {
					Q.push({ i,j });
					s[i][j] = '#';
					ans++;
				}
			}
		}
		while (!Q.empty()) {
			//cout << "hi";
			int cy, cx;
			cy = Q.front().first;
			cx = Q.front().second;
			for (int i = 0; i < 4; i++) {
				if (s[cy + dir[i]][cx + dir[i + 1]] == '.') {
					s[cy + dir[i]][cx + dir[i + 1]] = '#';
					ans++;
					Q.push({ cy + dir[i] ,cx + dir[i + 1] });
				}
			}
			Q.pop();
		}
		cout << ans << endl;
		cin >> W >> H;
	}
	return 0;
}

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

int main(){
	int x[4], y[4];
	cin >> x[1] >> y[1] >> x[2] >> y[2];

	x[3] = x[2]-(y[2]-y[1]);
	y[3] = y[2]+(x[2]-x[1]);
	x[4] = x[3]-(x[2]-x[1]);
	y[4] = y[3]-(y[2]-y[1]);
	
	cout << x[3] << " " << y[3] << " " << x[4] << " " << y[4] << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N=sc.nextInt();
		boolean f=true;
		for(int i=0;i<N;i++ ) {
			int t=sc.nextInt();
			if(f&&t%2==0) {
				if(t%3==0||t%5==0) {
					continue;
				}else {
					f=false;
					break;
				}
			}
		}
		System.out.println(f?"APPROVED":"DENIED");
	}
}


Measured memory_bytes: 35884
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


//main function
fn main() {
    let x: i8 = read();
    if x==3 || x==5 || x==7{
	println!("YES");
    }else{
	println!("NO");
    }
}


Measured memory_bytes: 4352
#define rep(i,n) for(i=0;i<(n);i++)
const int INF=1<<29;

int main(){
int n,m;
	for(;scanf("%d%d",&n,&m),n;){
		int t=INF,pre,ans,cnt=0,i;
		rep(i,n){
			int a; scanf("%d",&a);

			int j;
			for(j=m;j%a;j--);

			if(j<t || (j==t && a<=pre)){
				cnt=(j==t&&a==pre?cnt+1:1);
				t=j;
				pre=a;
				ans=i;
			}
		}

		printf("%d\n",cnt<2?ans+1:n);
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

int main(){
	int a,b,c,d,e,f;
	double ans=-1;
	int ansS;
	int ansW;

	std::cin>>a>>b>>c>>d>>e>>f;

	std::vector<bool> wList(31, false);
	std::vector<bool> sList(3001, false);

	for(int i=0; i<=30; i++)
		for(int j=0; j<=30; j++)
			if(a*i+b*j<=30)
				wList[a*i+b*j]=true;
		

	for(int i=0; i<=3000; i++)
		for(int j=0; j<=3000; j++)
			if(c*i+d*j<=3000)
				sList[c*i+d*j]=true;
	
	for(int i=0; i<=30; i++){
		for(int j=0; j<=3000; j++){
			if(!wList[i] || !sList[j])
				continue;

			if(100*i+j>f)
				continue;

			double ce= (double)e/(double)(100+e);
			double cnc= (double)j/(double)(100*i+j);

			if(cnc>ce)
				continue;

			if(ans<cnc){
				ans= cnc;
				ansW= i*100;
				ansS= j;
			}

		}
	}

	std::cout<< ansW+ansS<<" "<<ansS<<std::endl;


	return 0;
		
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define endl        "\n"
#define P           pair<int, int>
#define dint        long double

const int mod = 1e9+7;

dint dis(dint a, dint b, dint c, dint d) {
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
}

const int N = 1005;
vector<pair<dint, int>> g[N];
dint d[N];

struct point {
    dint x, y, r;
};

point a[N];
int n;

void Dijkstra(int root) {  
    for(int i=0; i<N; i++) d[i] = (dint)9e18;
    d[root] = 0;
    priority_queue<pair<dint, int>, vector<pair<dint, int>>, greater<pair<dint, int>> > pq;
    bool mark[N]; memset(mark, 0, sizeof mark);
    pq.push({0, root});
    while(!pq.empty()) {
        pair<dint, int> tp = pq.top(); pq.pop();
        int u = tp.second;
        if(mark[u] == 1) continue;
        mark[u] = 1;
        for(auto nei : g[u]) {
            int v = nei.second;
            dint w = nei.first;
            if(d[u] + w < d[v]) {
                d[v] = d[u] + w;
                pq.push({d[v], v});
            }
        }
    }
}

void solve() { 
    dint aa, b, c, dd; 
    cin >> aa >> b >> c >> dd;
    cin >> n;
    a[n+1].x = aa, a[n+1].y = b, a[n+1].r = 0;
    a[n+2].x = c, a[n+2].y = dd, a[n+2].r = 0;
    for(int i=1; i<=n; i++) cin >> a[i].x >> a[i].y >> a[i].r;
    for(int i=1; i<=n+1; i++) {
        for(int j=i+1; j<=n+2; j++) {
            dint w = dis(a[i].x, a[i].y, a[j].x, a[j].y) - a[i].r - a[j].r;
            w = max((dint)0, w);
            g[i].push_back({w, j});
            g[j].push_back({w, i});
        }
    }
    Dijkstra(n+1);
    cout << d[n+2] << endl;
}

signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);

    int T = 1;
    //cin >> T;

    while(T--) {
        solve();
    }
    return 0;
}



inline int add(int a, int b) { int res = a + b; if(res >= mod) res -= mod;  return res; }
inline int sub(int a, int b) { int res = a - b; if(res < 0) res += mod; return res;}
inline int mul(int a, int b) { return (a * b)%mod; }

int modpow(int a, int b) {
    int ans = 1;
    while(b) {
        if(b%2) ans = mul(ans, a);    
        b /= 2; a = mul(a, a);
    }   return ans;
}

Measured memory_bytes: 42384
import java.util.*;

public class Main {

  public static void main(String args[]) {
    (new Main()).solve();
  }

  void solve() {

    Scanner cin = new Scanner(System.in);

    int N = cin.nextInt();
    int array[] = new int[N];
    int rev[] = new int[N];
    
    for( int i = 0; i < N; ++i ) {
    	array[i] = cin.nextInt() - 1;
    	rev[ array[i] ] = i;
    }
    
    
    int ans = 1;
    int cur = 0;
    while( cur < N ) {
    	int seq = 1;
    	while( cur + 1 < N && rev[ cur ] < rev[ cur + 1 ] ) {
    		++seq;
    		++cur;
    	}
    	ans = Math.max(ans, seq);
    	++cur;
    }
    
    System.out.println(N - ans);

    cin.close();

  }

}


Measured memory_bytes: 66120
#include<stdio.h>
#include<vector>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int L=128,C=62;
vector<int> s[C*4+3],apr[C+3];int diff;
char decode(int x){return x<=26?64+x:(x<=52?96-26+x:48+x-52-1);}
bool ask(int u,int i,int j)
{
  int len=diff;
  printf("? ");rep(k,s[u].size()){len--;printf("%c",decode(s[u][k]));}len--;printf("%c",decode(s[u<<1][i]));
  rep(k,s[u<<1|1].size()-j){len--;printf("%c",decode(s[u<<1|1][k+j]));}puts("");fflush(stdout);
  int res;if(scanf("%d",&res)!=0)return res==len;else return -1;
}
void solve(int u,int le,int ri)
{
  if(le==ri){s[u]=apr[le];return;}
  int mid=(le+ri)>>1;
  solve(u<<1,le,mid);solve(u<<1|1,mid+1,ri);
  for(int i=0,j=0;i<(int)s[u<<1].size()||j<(int)s[u<<1|1].size();)
  {
    if(i<(int)s[u<<1].size()&&(j==(int)s[u<<1|1].size()||ask(u,i,j))){s[u].push_back(s[u<<1][i]); i++;}
    else{s[u].push_back(s[u<<1|1][j]);j++;}
  }
}
int main(void)
{
  for(int i=1;i<=C;i++)
  {
    printf("? ");rep(j,L){printf("%c",decode(i));}puts("");fflush(stdout);
    int res;if(!scanf("%d",&res))return -1;
    rep(j,L-res)apr[i].push_back(i);
    diff+=apr[i].size();
  }
  solve(1,1,C);
  printf("! ");rep(i,s[1].size())printf("%c",decode(s[1][i]));puts("");fflush(stdout);
  return 0;
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

void solve(){
    int l,r,d;
    cin>>l>>r>>d;
    cout<<r/d-(l-1)/d<<endl;
}

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

Measured memory_bytes: 3612
import math
x=int(input())
if x<4:
    print(1)
else:
    k=0
    for i in range(int(math.sqrt(x))-1):
        l=0
        for j in range(x):
            if (i+2)**j>x:
                break
            else:
                l=(i+2)**j
        if l>k:
            k=l
    print(k)


Measured memory_bytes: 3060