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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2047;
int n;
double x[N];
double y[N];

double dist(double ax, double ay, double bx, double by)
{
	return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
}

double get_r(double X, double Y)
{
	double ans = 0;
	FOR(i, 0, n) setmax(ans, dist(X, Y, x[i], y[i]));
	return ans;
}

double ternar_y(double X)
{
	double l = 0, r = N;
	FOR(it, 0, 200)
	{
		double m1 = l + (r - l) / 3.0;
		double m2 = r - (r - l) / 3.0;
		double v1 = get_r(X, m1);
		double v2 = get_r(X, m2);
		if (v1 > v2) l = m1;
		else r = m2;
	}
	
	return (l + r) / 2.0;
}

double ternar_x()
{
	double ans = INF;
	double l = 0, r = N;
	FOR(it, 0, 200)
	{
		double m1 = l + (r - l) / 3.0;
		double m2 = r - (r - l) / 3.0;
		double d1 = ternar_y(m1);
		double d2 = ternar_y(m2);
		double v1 = get_r(m1, d1);
		double v2 = get_r(m2, d2);
		if (v1 > v2) l = m1;
		else r = m2;
		
		ans = min(ans, v1);
		ans = min(ans, v2);
	}
	
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	cin >> n;
	FOR(i, 0, n) cin >> x[i] >> y[i];
	
	double ans = ternar_x();
	ans = sqrt(ans);
	cout << fixed << setprecision(10) << ans << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
ll n,a[100010], d[100010];

int main(){
	cin >> n; ll s = 0;
	REP(i,0,n) cin >> a[i], s += a[i];
	if(s % (n*(n+1)/2)){cout << "NO" << endl; return 0;}
	
	ll k = s / (n*(n+1)/2);
	REP(i,0,n) d[i] = a[i] - a[(i+1)%n];
	
	ll c = 0;
	REP(i,0,n){
		d[i] += k;
		if(d[i]%n||d[i]<0){cout << "NO" << endl; return 0;}
		c += (d[i] / n);
	}
	
	cout << (c == k ? "YES" : "NO")  << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;



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

	int x,a;
	cin>>x>>a;
	cout<<(x>=a)*10<<"\n";
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		int[] b=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		long[] dp=new long[n]; 
		dp[0]=1;
		for(int i=1;i<n;i++){
			long ga;
			long gb;
			if(a[i-1]*dp[i-1]%a[i]==0)ga=a[i-1]*dp[i-1]/a[i];
			else ga=a[i-1]*dp[i-1]/a[i]+1;
			if(b[i-1]*dp[i-1]%b[i]==0)gb=b[i-1]*dp[i-1]/b[i];
			else gb=b[i-1]*dp[i-1]/b[i]+1;
			dp[i]=Math.max(ga,gb);
		}
		System.out.println((long)(a[n-1]+b[n-1])*dp[n-1]);
	}
}

Measured memory_bytes: 23764
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"

using namespace std;

constexpr long long int MOD = 1000000007;
//const int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;

//const double EPS = 1e-8;

int N, M, K, H, W, L, R;
//long long int N, M, K, H, W, L, R;

int v[5001][5001];
int sum[5001][5002];

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

	cin >> K >> N;
	for (int i = 0; i < N; i++) {
		cin >> H >> W >> M;
		v[H + M][W] = max(v[H + M][W], M + 1);
	}
	for (int i = 5000; i >= 1; i--) {
		for (int j = 4999; j >= i; j--) {
			v[j][i] = max(v[j][i], v[j + 1][i] - 1);
		}
	}
	for (int i = 1; i <= 5000; i++) {
		for (int j = 1; j <= i; j++) {
			sum[i][j]++;
			sum[i][j + v[i][j]]--;
		}
	}
	for (int i = 1; i <= 5000; i++) {
		for (int j = 2; j <= i; j++)sum[i][j] += sum[i][j - 1];
	}
	int ans = 0;
	for (int i = 1; i <= 5000; i++) {
		for (int j = 1; j <= i; j++)ans += !!sum[i][j];
	}
	cout << ans << endl;
}


Measured memory_bytes: 136812
# coding: utf-8
# Your code here!

def LI():
    return list(map(int,input().split()))
    
n=int(input())
a=LI()
a.sort()
nums=[0]*(10**6+100)
for q in a:
    if nums[q]==0:
        nums[q]=1
        for j in range(2*q,10**6+1,q):
            nums[j]+=9
    elif nums[q]==1:
        nums[q]+=9
        

cnt=0
for i in nums:
    if i==1:
        cnt+=1
print(cnt)

Measured memory_bytes: 117300
time = int(input())

if time / 3600 > 0:
    hour = int(time/3600)
else:
    hour = 0
if (time - hour * 3600) / 60 > 0:
    minute = int((time - hour * 3600)/60)
else:
    minute = 0
if time - (hour*3600 + minute*60) > 0:
    second = int(time - (hour*3600 + minute*60))
else:
    second = 0
    
print(str(hour) + ":" + str(minute) + ":" + str(second))

Measured memory_bytes: 7600
def freq(my_list):
    count = {} 
    for i in my_list: 
        count[i] = count.get(i, 0) + 1
    return count

n = int(input())
l = list(map(int, input().split()))
s,f = sum(l), freq(l)
for _ in range(int(input())):
    x, y = map(int, input().split())
    if x in f.keys():
        v = f[x]
        if y in f.keys():
            f[y]+=v
            f.pop(x)
        else:
            f[y]=f.pop(x)
        s += (y-x)*v
    print(s)

Measured memory_bytes: 20816
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int n,o[100005]={},e[100005]={};
  cin >> n;
  for(int i=0; i<n; i++) {
    int a;
    cin >> a;
    if((i+1)%2==1) {
      o[a]++;
    }
    else {
      e[a]++;
    }
  }
  int Me=0,Mo=0,ei,oi;
  for(int i=1; i<=100000; i++) {
    if(Me<e[i]) {
      Me=e[i],ei=i;
    }
    if(Mo<o[i]) {
      Mo=o[i],oi=i;
    }
  }
  sort(e,e+100005,greater<int>());
  sort(o,o+100005,greater<int>());
  if(ei==oi) {
    cout << min(n-e[0]-o[1],n-e[1]-o[0]) << endl;
  }
  else {
    cout << n-e[0]-o[0] << endl;
  }
}

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

int main()
{
			int a[3][3];
			for(int i=0;i<3;i++)
			{
				for(int j=0;j<3;j++)
				{
					cin>>a[i][j];
				}
			}
			int n; cin>>n;
			set<int>s; int x;
			for(int i=0;i<n;i++)
			{
				cin>>x;
				s.insert(x);
			}
	
			int cnt=0;
			bool can=false;
			for(int i=0;i<3;i++)
			{
				for(int j=0;j<3;j++)
				{
					if(s.count(a[i][j]))
						{
							cnt++;
							
						}
				}
			if(cnt==3){can=true; break;}
			cnt=0;
			}
			for(int i=0;i<3;i++)
			{
				for(int j=0;j<3;j++)
				{
					if(s.count(a[j][i]))
						{cnt++;}
				}
			if(cnt==3){can=true; break;}
			cnt=0;
			}
			//cout<<can;
			int l=a[0][0], m=a[1][1], c=a[2][2];
			int u=a[0][2], r=a[1][1], d=a[2][0];
			if((s.count(l) && s.count(m)&&s.count(c))||(s.count(u)&&s.count(r)&&s.count(d)))
			{
				can=true;
			}
			cout<<(can?"Yes":"No");
			
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String first = scanner.next();
        String second = scanner.next();
        int firstInt = scanner.nextInt();
        int secondInt = scanner.nextInt();

        String decision = scanner.next();

        if(decision.equals(first)){
            System.out.println((firstInt - 1) + " " + secondInt);
        } else {
            System.out.println(firstInt + " " + (secondInt - 1));
        }
    }
}


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

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		int x = sc.nextInt();
		println(x / 500 * 1000 + x % 500 / 5 * 5);
	}
}


Measured memory_bytes: 23380
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const int N = 2e7 + 7;
const int mod=1e9+7;
const int INF=1e18+7;
const int dx[] = {-1, 1, 0,  0}; // UDLR
const int dy[] = { 0, 0, -1, 1}; // UDLR
inline int maximum (int a,int b){
     if(a>b) return a;
     else return b;
}
inline int minimum (int a,int b){
    if(a>b) return b;
     else return a;
}
int32_t main (){
    ios_base::sync_with_stdio(false);
     cin.tie(NULL);cout.tie(NULL);

        int n; cin>>n; vector<int> h(n); vector<int>dp(n+1,INF);
        for(int i=1;i<=n;i++) cin>>h[i];
        dp[1]=0; dp[2]=abs(h[2]-h[1]);
        for(int i=3;i<=n;i++){
            dp[i]=minimum(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
        }
         cout<<dp[n];
 return 0;
 }


Measured memory_bytes: 4680
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
  long long a,b,c;
  cin>>a>>b>>c;
  cout<<min({abs(a*b*(c/2)-a*b*((c+1)/2)),abs(b*c*(a/2)-b*c*((a+1)/2)),abs(c*a*(b/2)-c*a*((b+1)/2))})<<endl;
  return 0;
}


Measured memory_bytes: 256
//****** @author mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void solve() {
    string s;cin>>s;
    string t=s;
    ll ans=0;
    for(ll i=0;i<s.length();i++){
        if(s[i]!=t[s.length()-1-i])ans++;
    }
    cout<<ans/2<<endl;
}
int main()
{
    IOS;
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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



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

    vector<long long> x(n);
    vector<long long> y(n);

    vector<long long> lt(n);
    vector<long long> rt(n);
    vector<long long> lb(n);
    vector<long long> rb(n);

    long long temp = 1000000000;

    for (int i = 0; i < n; i++)
    {
        long long x, y;
        cin >> x >> y;

        lt[i] = (x - 1) + (y - 1);
        rt[i] = (temp - x) + (y - 1);
        lb[i] = (x - 1) + (temp - y);
        rb[i] = (temp - x) + (temp - y);
    }

    std::sort(lt.begin(), lt.end());
    std::sort(rt.begin(), rt.end());
    std::sort(lb.begin(), lb.end());
    std::sort(rb.begin(), rb.end());

    long long ltrb = temp * 2 - (lt[0] + rb[0]);
    long long rtlb = temp * 2 - (rt[0] + lb[0]);

    long long ans = max(ltrb, rtlb) - 2;


    cout << ans << endl;
}

Measured memory_bytes: 12700
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int main() {
	fastio;
	int N;
	cin >> N;

	cout << N / 2 + N % 2;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef priority_queue<double, vector<double>, less<double> > QUE_double;
typedef priority_queue<int, vector<int>, less<int> > QUE_int;//lessは大きい順にならべるよ
const int MAX = pow(10, 5)+1;//+1しないとREになる(out of rangeになるんかな?? )
int main(){
  int a,b;
  cin >> a >> b;
  int ans = 0;
  if(a != 1 && b != 1) ans =  1;
  if(a != 2 && b != 2) ans =  2;
  if(a != 3 && b != 3) ans =  3;
  cout << ans << endl;
}


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

int main() {
  int N;
  ll D;
  cin >> N >> D;

  ll X[N], Y[N];
  for (int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i];
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if ( X[i]*X[i]+Y[i]*Y[i]<=D*D ){
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6760
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int n,l,q,a,b,x[100000],jump[100000][17];
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&x[i]);
    scanf("%d",&l);
    for(int i=n-1,j=n-1;i>=0;i--){
        while(x[j]-x[i]>l)j--;
        jump[i][0]=j;
        for(int k=1;k<=16;k++){
            jump[i][k]=jump[jump[i][k-1]][k-1];
        }
    }
    scanf("%d",&q);
    while(q--){
        scanf("%d %d",&a,&b);
        if(a>b)swap(a,b);
        a--;
        b--;
        int an=0;
        for(int i=16;i>=0&&a<b-1;){
            if(jump[a][i]>b-1){
                i--;
                continue;
            }
            an+=(1<<i);
            a=jump[a][i];
        }
        an++;
        printf("%d\n",an);
    }
    return 0;
}

Measured memory_bytes: 7808
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  




	int num[11][11];
void solve(){
	int n;
	cin >> n ;
	int ans = 0 ; 

	fr(i,1,n){
		string s = to_string(i);
		
		int a = s[0] - '0';
		int b = s.back() - '0'; 
		ans+=2*(num[b][a]);
		ans +=(a==b);
		num[a][b]++;
	}
	cout << ans << endl; 
}



signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3772
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#define N 100005
using namespace std;

int n, m, s, t, d[N][3];
vector<int> gr[N];
queue<pair<int,int>> qu;

int main() {
	int i, t1, t2, u, c;
	cin >> n >> m;
	while(m--) {
		scanf("%d%d", &t1, &t2);
		gr[t1].push_back(t2);
	}
	memset(d, 0x7f, sizeof(d));
	cin >> s >> t;
	qu.push({s, 0});
	d[s][0] = 0;
	while(!qu.empty()) {
		u = qu.front().first;
		c = qu.front().second;
		qu.pop();
		for(int v:gr[u]) {
			if(d[u][c] + 1 < d[v][(c+1)%3]) {
				d[v][(c+1)%3] = d[u][c] + 1;
				qu.push({v, (c+1)%3});
			}
		}
	}
	cout << (d[t][0]%3 ? -1 : d[t][0]/3);
	return 0;
}

Measured memory_bytes: 6912
let readInt _ = stdin.ReadLine() |> int

()
|> readInt
|> fun x -> [ 1 .. x ]
|> List.map readInt
|> fun l ->
    let [ m1; m2 ] = l |> List.sortDescending |> List.take 2
    (m1, m2, l)
|> fun (m1, m2, l) ->
    for i in l do
        if i = m1 then printfn "%d" m2 else printfn "%d" m1


Measured memory_bytes: 59152
#include <iostream>
#include <set>
#include <vector>
using namespace std;
constexpr int mod = 1'000'000'007;

int solve(const vector<char> &forbid, vector<int> &dp, const int step, const int step_goal) {
    if (dp[step] >= 0) {
        return dp[step];
    }

    if (step > step_goal) {
        dp[step] = 0;
        return 0;
    }
    if (step == step_goal) {
        dp[step] = 1;
        return 1;
    }

    auto ans = 0LL;
    if (!forbid[step + 1]) {
        ans += solve(forbid, dp, step + 1, step_goal);
    }
    if (!forbid[step + 2]) {
        ans += solve(forbid, dp, step + 2, step_goal);
    }

    ans %= mod;
    dp[step] = ans;
    return ans;
}

int main() {
    int n, m;
    cin >> n >> m;
    auto forbid = vector<char>(n + 1);
    for (int i = 0; i < m; i++) {
        int a_i;
        cin >> a_i;
        forbid[a_i] = true;
    }

    auto dp = vector<int>(n + 10, -1);
    cout << solve(forbid, dp, 0, n);
    return 0;
}


Measured memory_bytes: 7040
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int readS = Integer.parseInt(reader.readLine());
     
    int hour = readS / 3600;
    readS -= hour * 3600;
    int minutus = readS / 60;
    readS -= minutus * 60;
    int second = readS;
     
    System.out.println(hour+":"+minutus+":"+second);
  }
 
}

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

    int t, n, sum;

    void run(){
	while(sc.hasNext()){
	    t = sc.nextInt();
	    if(t==0) break;
	    n = sc.nextInt();
	    sum = 0;

	    for(int i=0; i<n; i++)
		sum += Math.abs(sc.nextInt() - sc.nextInt());
	
	    System.out.println(sum>=t ? "OK" : (t-sum));
	}
    }
}

Measured memory_bytes: 23440
#include <stdio.h>

typedef struct tagS_RECTANGLE {
	int H;
	int W;
} S_RECTANGLE;

int main( void )
{
	S_RECTANGLE sRectangle;
	int i;
	int j;

	while( 1 ){
		scanf( "%d %d", &sRectangle.H, &sRectangle.W );
		if( sRectangle.H == 0 && sRectangle.W == 0 ){
			break;
		}
		for( i = 0; i < sRectangle.H; i++ ){
			for( j = 0; j < sRectangle.W; j++ ){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 572
//問題やり直し
#include <iostream>
#include <string>
using namespace std;

typedef struct{           /* _person がタグ名 */
    int x,y,t;               /* 整数型メンバ age */
} acord_t;

int main(void)
{
  int N;
  cin >> N;
  acord_t point[N];
  for(int i=0; i<N; i++){
    cin >> point[i].t;
    cin >> point[i].x;
    cin >> point[i].y;
  }

  for(int j=0; j<N; j++){
    // cout << "fucnk";
    int x_dis,y_dis,t_dis;
    if(j==0){
      x_dis = point[j].x;
      y_dis = point[j].y;
      t_dis = point[j].t;
    }else{
      x_dis = point[j].x - point[j-1].x;
      y_dis = point[j].y - point[j-1].y;
      t_dis = point[j].t - point[j-1].t;
    }

    int x_front,x_back,y_front,y_back;
    //x_back+y_back=1/2{t_dis-x_dis-y_dis}
    if((t_dis-x_dis-y_dis) %2 != 0){
      cout << "No\n";
      return 0;
    }
    int x_back_min, y_back_min;
    if(x_dis>0){
      x_back_min = 0;
    }else{
      x_back_min = -x_dis;
    }
    if(y_dis>0){
      y_back_min = 0;
    }else{
      y_back_min = -y_dis;
    }
    if(x_back_min+y_back_min > (t_dis-x_dis-y_dis)/2){
      cout << "No\n";
      return 0;
    }
    // if(abs(x_dis)+abs(y_dis) > t_dis){
    //   cout << "No\n";
    //   return 0;
    // }
  }

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


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

int main(){
    int n,i,j,swap=0,minj,count=0;
    cin >> n;
    int a[n];

    for(i=0;i<n;i++) cin >> a[i];

    for(i=0;i<n-1;i++){
        minj = i;
        for(j=i;j<n;j++){
            if(a[j]<a[minj]) minj = j;
        }
        if(minj != i){
            swap = a[minj];
            a[minj] = a[i];
            a[i] = swap;
            count++;
        }
    }
    for(i=0;i<n;i++){
        cout << a[i];
        if(i!=n-1) cout << " ";
    }
    cout << endl;
    cout << count << endl;
    return 0;

}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
int32_t main(){
    if(fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin),
    freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0),cin.tie(0);
    string st;
    cin >> st;
    int ok=1;
    if(st.size()!=6){
        cout << "No";
        return 0;
    }
    if(st[2]!=st[3])ok=0;
    if(st[4]!=st[5])ok=0;
    if(ok)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L
#define PI 3.141592653589793238462643383279502884L

#define long long long int

using std::vector;
using std::map;
using std::set;
using std::string;
using std::pair;
using std::cin;
using std::cout;
using std::cerr;

// @author: pashka

vector<vector<int>> g;

int main() {
    std::ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;

    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        c[i] = s[i] - 'A';
    }

    g.resize(n);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--;y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    vector<vector<int>> q(2, vector<int>(n));
    for (int i = 0; i < n; i++) {
        for (int j : g[i]) {
//            cout << i << " " << j << " " << c[i] << "\n";
            q[c[i]][j]++;
        }
    }

    vector<bool> z(n);
    vector<int> queue;
    for (int i = 0; i < n; i++) {
        if (q[0][i] == 0 || q[1][i] == 0) {
            z[i] = true;
            queue.push_back(i);
        }
    }
    for (int i = 0; i < queue.size(); i++) {
        int x = queue[i];
        for (int y : g[x]) {
            q[c[x]][y]--;
            if (q[c[x]][y] == 0 && !z[y]) {
                z[y] = true;
                queue.push_back(y);
            }
        }
    }
    if (queue.size() == n) {
        cout << "No";
    } else {
        cout << "Yes";
    };


    return 0;
}

Measured memory_bytes: 14180
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int w, h;
int MAP[60][60];

#define x first
#define y second

int bfs() {
	VII dist(2 * h - 1, VI (2 * w - 1,INT_MAX));
	queue<PII> que;
	que.push(mp(0, 0));
	dist[0][0] = 0;
	while(!que.empty()){
		PII now = que.front();
		MAP[now.y][now.x] = 0;
		que.pop();
		rep(i, 4){
			int nx = now.x + DX[i];
			int ny = now.y + DY[i];
			if(range(nx, 0, 2 * w - 2) && range(ny, 0, 2 * h - 2) && !MAP[ny][nx]){
				if(dist[now.y][now.x] + 1 >= dist[ny + DY[i]][nx + DX[i]]) continue;
				dist[ny + DY[i]][nx + DX[i]] = dist[now.y][now.x] + 1;
				que.push(mp(nx + DX[i], ny + DY[i]));
			}
		}
	}
	return dist[2 * h - 2][2 * w - 2] != INT_MAX? dist[2 * h - 2][2 * w - 2] : -1;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	while(1){
		rep(i, 60){
			rep(j, 60){
				MAP[i][j] = 0;
			}
		}
		cin >> w >> h;
		if(w == 0 && h == 0) break;
		for(int i = 0;i < 2 * h - 1;i++){
			int size = i % 2? w : w - 1;
			for(int j = 0;j < size;j++){
				int a;
				cin >> a;
				MAP[i][2 * j + !(i % 2)] = a;
			}
		}
		cout << bfs() + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> west(n), east(n);
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'W')
            west[i] = 1;
    }
    for (int i = n - 1; 0 <= i; i--)
    {
        if (s[i] == 'E')
            east[n - 1 - i] = 1;
    }
    vector<ll> wsum(n + 1, 0), esum(n + 1, 0);
    for (int i = 0; i < n; i++)
    {
        wsum[i + 1] = west[i] + wsum[i];
    }
    for (int i = 0; i < n; i++)
    {
        esum[i + 1] = east[i] + esum[i];
    }
    reverse(esum.begin(), esum.end());
    ll ans = 1145141919810;
    for (int i = 0; i < n + 1; i++)
    {
        ans = min(ans, esum[i + 1] + wsum[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 10004
n, m = gets.split().map(&:to_i)
a = gets.split().map(&:to_i)
vote = a.inject(&:+)
border = vote / (4.0*m)

a.sort.reverse.slice(0, m).each do |num|
  if num < border
    puts "No"
    exit
  end
end

puts "Yes"

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

/* Struct Declaration */
struct node {
  int key;
  struct node *parent;
  struct node *left;
  struct node *right;
};

typedef struct node * NodePointer;

/* Prototype Declaration */
void insert(int);
NodePointer search(int);
void printBinaryTree(void);
void printPreorder(NodePointer);
void printInorder(NodePointer);

/* Global Variable */
NodePointer root;

/* Main */
int main() {
  int i, n, k;
  NodePointer find;
  char command[15];

  root = (NodePointer)malloc(sizeof(struct node));
  root = NULL;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) {
    scanf("%s", command);
    if ( strcmp(command, "insert") == 0 ) {
      scanf("%d", &k);
      insert(k);
    }else if ( strcmp(command, "find") == 0 ) {
      scanf("%d", &k);
      find = search(k);
      if ( find == NULL ) printf("no\n");
      else printf("yes\n");
    }else if ( strcmp(command, "print") == 0 ) {
      printBinaryTree();
    }
  }

  return 0;
}

/* Insert to Binary Tree */
void insert(int keydata) {
  NodePointer x = root;
  NodePointer y = NULL;
  NodePointer z;

  z = (NodePointer)malloc(sizeof(struct node));

  z->key = keydata;
  z->left = NULL;
  z->right = NULL;

  //Set Parent of New Node
  while (x != NULL) {
    y = x;
    if ( z->key < x->key ) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  
  if ( y == NULL ) root = z;
  else {
    if ( z->key < y->key ) y->left = z;
    else y->right = z;
  }
}

/* Search for Key from Binary Tree */
NodePointer search(int keydata) {
  NodePointer x = root;

  while ( x != NULL && x->key != keydata ) {
    if ( x->key < keydata ) x = x->right;
    else if ( x->key > keydata ) x = x->left;
  }

  return x;
}

/* Print Binary Tree */
void printBinaryTree() {
  //Inorder Walk
  printInorder(root);
  printf("\n");
  //Preorder Walk
  printPreorder(root);
  printf("\n");
}

/* Preorder Walk */
void printPreorder(NodePointer u) {
  if ( u == NULL ) return;

  printf(" %d", u->key);
  printPreorder(u->left);
  printPreorder(u->right);
}

/* Inorder Walk */
void printInorder(NodePointer u) {
  if ( u == NULL ) return;

  printInorder(u->left);
  printf(" %d", u->key);
  printInorder(u->right);
}

Measured memory_bytes: 19364
#include<vector>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
using namespace std;


int main()
{
	int i, j, k, l, m, N,sum,flag;
	sum = 0;
	flag = 0;
	char S[4];
	cin >> S;
	for (i = 0; i <= 3; i++) {
		if (S[i] == '+')
			sum++;
		else
			sum--;
	}
	cout << sum << endl;

    return 0;
}



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

const int N = 111111;
vector<pair<int, ll> > tree[N];
int subc[N];
ll ans;
int n;

void dfs(int node, int p = 0) {
    subc[node] = 1;
    for(pa : tree[node]) {
        int nnode = pa.first;
        if(nnode != p) {
            dfs(nnode, node);
            subc[node] += subc[nnode];
        }
    }
    int maxi = 0;
    for(pa : tree[node]) {
        int nnode = pa.first;
        ll cost = pa.second;
        if(nnode != p) {
            maxi = max(maxi, subc[nnode]);
            int sz = min(subc[nnode], n - subc[nnode]);
            ans += sz * cost * 2;
            if(2 * sz == n) {
                ans -= cost;
            }
        }
    }
    maxi = max(maxi, n - subc[node]);
    if(maxi * 2 < n) {
        ll minic = 1LL << 62;
        for(pa : tree[node]) {
            ll cost = pa.second;
            minic = min(minic, cost);
        }
        ans -= minic;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 1; i < n; i++) {
        int u, v;
        ll c;
        cin >> u >> v >> c;
        tree[u].push_back(make_pair(v, c));
        tree[v].push_back(make_pair(u, c));
    }
    dfs(1);
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int vect[100000];
    long long dp[100000];
    int n;
    cin>>n;
    int i,hi;
    for(i=0;i<n;i++)
    {
        cin >> vect[i];
    }
    for(i=1;i<n;i++)
    {
        if(i == 1)
        {
            dp[i]=abs(vect[i]-vect[i-1]);
        }
        else{
            dp[i]=min(abs(vect[i]-vect[i-1])+dp[i-1],abs(vect[i]-vect[i-2])+dp[i-2]);
        }
    
    }
    cout<<dp[n-1]<<endl;
    
}

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

public class Main {
	static int a,b;
    
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       while(true) {
    	   int n = sc.nextInt();
    	   int m = sc.nextInt();
    	   if(n+m==0)break;
    	   int[] a = new int[n];
    	   for(int i=0;i<n;i++) {
    		   a[i] = sc.nextInt();
    	   }
    	   int ans = 0;
    	   for(int i=0;i<n;i++) {
    		   for(int j=0;j<n;j++) {
    			   if(i==j)continue;
    			   if(ans < a[i]+a[j] && a[i]+a[j] <= m) ans = a[i]+a[j];
    		   }
    	   }
    	   if(ans == 0) System.out.println("NONE");
    	   else  System.out.println(ans);
       }
    }
}


Measured memory_bytes: 51352
/*
Dont BLUNDER
*/
#include<bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;*/
 
//#define d long double
#define int long long
#define pii pair<int,int>
#define pb push_back
#define endl '\n'
#define inf (int)1e18
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
int const mod1=998244353;
int const mod=1000000007;
#define l first
#define r second
int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
 #define haha ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// ******** Using PBDS ********
 /*typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
                os; */
 
int modexp(int x, int n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}
 
int modinv(int n)
{
	return modexp(n,mod-2);
}


signed main() {
	haha
	int a,b;
	cin>>a>>b;
	cout<<a*b;
	




}

Measured memory_bytes: 3656
#[allow(unused_imports)]
use proconio::{
    fastout, input,
};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [i32; n],
        q: usize,
        bc: [(i32, i32); q],
    }
    let mut counter = std::collections::HashMap::new();
    for &v in a.iter() {
        let e = counter.entry(v).or_insert(0);
        *e += 1;
    }
    let mut sum = a.iter().map(|&x| x as i64).sum::<i64>();
    for &(b, c) in bc.iter() {
        let increase = {
            let e = counter.entry(b).or_insert(0);
            std::mem::replace(e, 0)
        };
        sum += ((c - b) as i64) * (increase as i64);
        let e = counter.entry(c).or_insert(0);
        *e += increase;
        println!("{}", sum);
    }
}


Measured memory_bytes: 6776
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int dp[100010];
  dp[0] = 0;
  rrep(i,100000){
    int power=1;
    dp[i] = INF;
    while(power<=i){
      dp[i] = min(dp[i], 1+dp[i-power]);
      power *= 9;
    }
    power = 1;
    while(power<=i){
      dp[i] = min(dp[i], 1+dp[i-power]);
      power *= 6;
    }
  }
      
  int n;
  cin >> n;
  cout << dp[n] << endl;
  return 0;
  
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, k, a[114514];
signed main() {
	cin >> n >> k;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	if (a[n - 1] < k) {
		cout << "IMPOSSIBLE" << endl;
		endre;
	}
	int g = gcd(a[0], a[1]);
	for (int i = 2; i < n; i++) {
		g = gcd(g, a[i]);
	}
	if (k%g)cout << "IMPOSSIBLE" << endl;
	else cout << "POSSIBLE" << endl;
	endre;
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<29;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<59; 

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N ;
  vl a(N);
  rep(i,N) cin >> a[i] ;
  sort(ALL(a));
  ll ans = 0;
  ll temp = 0;
  if(N%2){
    REP(i,0,N/2) temp -= a[i];
    REP(i,N/2,N) temp += a[i];
    temp *= 2;
    chmax(ans,temp-(a[N/2]+a[N/2+1]));
    temp = 0;
    REP(i,0,N/2+1) temp -= a[i];
    REP(i,N/2+1,N) temp += a[i];
    temp *= 2;
    chmax(ans,temp+a[N/2]+a[N/2-1]);
  }else{
    REP(i,0,N/2) temp -= a[i];
    REP(i,N/2,N) temp += a[i];
    temp *= 2;
    chmax(ans,temp+a[N/2-1]-a[N/2]);

  }
  cout << ans << endl;
  return 0;
}


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

int main(void)
{
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1 + a2 + a3 >= 22) cout << "bust" << endl;
    else  cout << "win" << endl;
}



Measured memory_bytes: 256
A=[[[0]*10 for i in range(3)] for j in range(4)]

i=1
#情報数
numbers=[]
info=[]
u=""   
number_str=input("")
number=int(number_str)

while i <=number:
    x=input()
    numbers=x.split()
    numbers=list(map(int,numbers))
    info.append(numbers)
    i=i+1

for j in info:
    A[j[0]-1][j[1]-1][j[2]-1]=A[j[0]-1][j[1]-1][j[2]-1]+j[3]


for h in range(0,4):
    for i in range(0,3):
        for j in range(0,10):
            u=u+" "+str(A[h][i][j])
        print(u)    
        u=""
    
    if h<3 : 
        print("#"*20)




Measured memory_bytes: 5612
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 3e5+7 ;
//const int INF = 1e18 ;
//const int MOD = 1e9 + 7 ;
int dp[N][2] ;

void solve(){
	int n ;
	cin >> n ;
	vi a(n) ;
	for(auto& x : a) cin >> x ;
	dp[2][0] = a[0] ;
	dp[2][1] = a[1] ;
	for(int i = 3 ; i <= n ; i++){
		if(i&1){
			dp[i][1] = a[i-1]+max({dp[i-2][0],dp[i-2][1],dp[i-3][0],dp[i-3][1]})   ;
			dp[i][0] = dp[i-1][1];
		}
		else{
			dp[i][1] = a[i-1]+ max({dp[i-1][0], dp[i-2][0], dp[i-2][1]})  ;
			dp[i][0] = a[i-2]+ dp[i-2][0] ;
		}
	}
	cout << max(dp[n][1], dp[n][0]) ;
}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


Measured memory_bytes: 7996
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[] a = new int[n];
        long[] n_1_N = new long[n+1];
        for(int i=0; i<=n; i++){
            n_1_N[i]=0;
        }
        
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
            n_1_N[a[i]]++;
        }
        
        long combi_sum = 0;
        for(int i=1; i<=n; i++){
            long tmp = n_1_N[i];
            if(tmp > 1) combi_sum += tmp*(tmp-1);
        }
        combi_sum /=2;
        
        for(int i=0; i<n; i++){
            long tmp = n_1_N[a[i]];
            if(tmp > 1){
                tmp--;
                out.println(combi_sum-tmp);
            }else{
                out.println(combi_sum);
            }
        }
        out.flush();
    }
}


class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 45708
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    string s;
    cin>>s;
    string ans="Yes";
    for(int i=0;i<s.size();i+=2){
        if(s.size()%2==1){
            ans="No";
            break;
        }
        if(s.at(i)!='h' || s.at(i+1)!='i'){
            ans="No";
            break;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

int main(){
    string S;
    int ans=0;
    cin >> S;
    for(int i=0; i<S.size(); i++){
        int cnt=0;
        if(S[i]=='A' | S[i]=='C' | S[i]=='G'|S[i]=='T'){
            for(int j=i; j<S.size(); j++){
                if(S[j]=='A' | S[j]=='C' |S[j]=='G' |S[j]=='T'){
                    cnt++;
                }else{
                    break;
                }
            }
        }
        if(cnt>ans){
            ans = cnt;
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int h, w;

		scanf("%d %d", &w, &h);
	while (!(h == 0 && w == 0))
	{
		if (h == 0 && w == 0)
		{
			break;
		}
		for (int i = 1; i <= w; i++)
		{
			for (int j = 1; j <= h; j++)
			{
				if (j % 2 == 1)
				{

					if (i % 2 == 1)
					{

						printf("#");
					}
					else
					{
						printf(".");
					}
				}
				else
				{
					if (i % 2 == 0)
					{
						printf("#");
					}
					else
					{
						printf(".");
					}
				}
			}
			printf("\n");
		}
		scanf("%d %d", &w, &h);
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

ll N;

ll solve(ll n) {
    if (n == 1) return 0;
    if (n == 2) return 1;
    return n * (n-1) / 2LL;
}

int main(int argc, const char * argv[]) {
    cin >> N;
    output(solve(N));
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int h[n+1];
    h[0]=0;
    for(int i=1;i<n+1;i++) cin>>h[i];
    int dp[n+1];
    dp[0]=0;
    dp[1]=0;dp[2]=abs(h[2]-h[1]);
    for(int i=3;i<n+1;i++)
    {
    	int ans=INT_MAX;
    	for(int j=1;j<=k;j++)
    	{
    		if((i-j)>0)
    		{
    			ans=min(ans,dp[i-j]+abs(h[i]-h[i-j]));
    		}
    	}
    	dp[i]=ans;
    }
    cout<<dp[n]<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
    /*考察
    右だけに石を置いて行っていい
     */
    string s;
    cin>>s;
    int var=0;
    for(int i=1;i<s.size();i++){
        if(s[i-1]!=s[i]) var++;
    }
    cout<<var<<endl;
    return 0;
}

Measured memory_bytes: 512