akhauriyash/Code-Regression huggingface dataset:
n = gets.to_i
t1,x1,y1 = 0,0,0
judge = "Yes"

n.times do
  s = gets
  t2,x2,y2 =s.strip.split(" ").map(&:to_i)
  t = t2 - t1
  d = (x2 - x1).abs + (y2 - y1).abs
  if d <= t && (t - d).even?
    t1 = t2
    x1 = x2
    y1 = y2
  else
    judge = "No"
    break
  end
end
print judge

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <vector>
#define N 200005
using namespace std;

int n, q, s[N];
bool v[N];
vector<int> gr[N];

void f(int p) {
	int i, ne;
	v[p] = 1;
	for (i = 0; i < gr[p].size(); i++) {
		ne = gr[p][i];
		if (!v[ne]) {
			s[ne] += s[p];
			f(ne);
		}
	}
}

int main()
{
	int i, t1, t2;
	cin >> n >> q;
	for (i = 1; i < n; i++) {
		scanf("%d %d", &t1, &t2);
		gr[t1].push_back(t2);
		gr[t2].push_back(t1);
	}
	while (q--) {
		scanf("%d %d", &t1, &t2);
		s[t1] += t2;
	}
	f(1);
	for (i = 1; i <= n; i++) printf("%d ", s[i]);
    return 0;
}

Measured memory_bytes: 23680
use std::io::*;
use std::str::FromStr;
use std::collections::VecDeque;

fn main() {
    let n: usize = read();
    let mut vec: Vec<Vec<usize>> = vec![Vec::new(); n];
    for i in 0..n-1 {
        let a: usize = read();
        let b: usize = read();
        vec[a-1].push(b-1);
        vec[b-1].push(a-1);
    }

    let mut c: Vec<i64> = (0..n).map(|_| read()).collect();
    c.sort();

    let mut max = 0;
    let mut max_n = 0;
    for i in 0..n {
        if max < vec[i].len() {
            max_n = i;
            max = vec[i].len();
        }
    }

    let mut que: VecDeque<usize> = VecDeque::new();
    let mut array = vec![0; n];
    que.push_back(max_n);
    array[max_n] = c[n-1];
    let mut po = n-1;
    while !que.is_empty() {
        let q = que.pop_front().unwrap();
        for i in &vec[q] {
            if array[*i] == 0 {
                que.push_back(*i);
                po -= 1;
                array[*i] = c[po];
            }
        }
    }
    
    let mut sum = 0;
    for i in 0..n-1 {
        sum += c[i];
    }
    println!("{}", sum);
    for i in 0..n {
        if i > 0 {
            print!(" ");
        }
        print!("{}", array[i]);
    }
    println!();
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int main(){
    int n;
    cin >> n;
    
    for(int i=1; i<=n; i++){
        if(i%3==0){
            cout << " " << i;
            continue;
        }
        int x=i;
        while(x!=0){
            if(x%10 == 3){
                cout << " " << i;
                break;
            }
            x/=10;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
ll factorial(ll a){return a < 2 ? 1 : factorial(a - 1) * a;}
ll summation(ll a){return a < 1 ? 0 : (a * a + a) / 2;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const string ALPHABETS = "abcdefghijklmnopqrstuvwxyz";
ll dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
//ll dx[] = {-1, 0, 1, -1, 1, -1, 0, 1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
ll n, m, x, y, z, w, h;
string s, t;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n){
        ll ans = 0, tmp = 0, cnt = 0, mx = -INF, mn = INF;
        ll schedule[n][10] = {}, profit[n][11] = {}, c[] = {};
        rep(i, n){
            rep(j, 10){
                cin >> schedule[i][j];
            }
        }
        rep(i, n){
            rep(j, 11){
                cin >> profit[i][j];
            }
        }
        rep(i, 1, 1 << 10){
            tmp = 0;
            rep(j, n){
                cnt = 0;
                rep(k, 10){
                    if(i >> k & schedule[j][k]){
                        cnt++;
                    }
                }
                tmp += profit[j][cnt];
            }
            maxs(mx, tmp);
        }
        print(mx);
    }
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,k,c = LI()
    s = S()

    l = set()
    i = 0
    while i < n:
        if s[i] == 'x':
            i += 1
        else:
            l.add(i+1)
            i += c + 1

    if len(l) > k:
        return ""

    r = set()
    i = n - 1
    while i >= 0:
        if s[i] == 'x':
            i -= 1
        else:
            r.add(i+1)
            i -= c + 1

    return JA(sorted(l & r), "\n")

print(main())





Measured memory_bytes: 59316
n = int(input())
a = list(map(int,input().split()))
sa = sum(a)
x1 = sa
for i in range((n-1)//2):
  x1 -= 2*a[2*i+1]
print(x1,end=" ")
nextx = x1
for i in range(n-1):
  nextx = 2*a[i] - nextx
  print(nextx,end=" ")
  

Measured memory_bytes: 14028
#include<stdio.h>

int main(){
	
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(b%a==0){
		
		printf("%d\n",a+b);
	
	}
	
	else{
		
		printf("%d\n",b-a);
	}
	
	
	return 0;
}

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

using namespace std;

using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1e18;

int main() {
    ll n, m, i, j, k;
    ll x;
    cin >> x >> n;
    vector<bool> p(110,0);
    for(i=0;i<n;i++){
        cin >> m;
        p[m]=1;
    }
    ll ret = INF;
    for(i=0;i<110;i++){
        if(p[i]==0){
            if(abs(x-i)<abs(ret-x)){
                ret = i;
            }
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int x = 1;
	string s;
	cin>> s;
	for(int i = 0;i < s.length();i++) {
		if (s[i+2] == s[i + 3] && s[i + 4] == s[i + 5]) {
			cout << "Yes";
			break;
		}
		else {
			cout << "No";
			break;
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

	public void run() {
		sc.useDelimiter("[, \r\n]+");
		while(true){
			int n=sc.nextInt();
			if(n==0)break;
			C[] clist=new C[n];
			for(int i=0;i<n;i++){
				clist[i]=new C(new P(sc.nextDouble(),sc.nextDouble()),1);
			}
			int max=1;
			for(int i=0;i<n;i++)for(int j=i+1;j<n;j++){
				ArrayList<P> sec=C.intersectionCC(clist[i],clist[j]);
				for(P secp:sec){
					int c=0;
					for(int k=0;k<n;k++){
						if(P.norm(secp,clist[k].p)-clist[k].r<=P.EPS)c++;
					}
					max=Math.max(c,max);
				}
			}
			ln(max);
		}
	}

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

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

class P {
	double x;
	double y;
	static final double EPS=1e-10;
	P(double _x,double _y){
		x=_x;
		y=_y;
	}

	public P a(P a){
		return new P(x+a.x,y+a.y);
	}
	public P s(P a){
		return new P(x-a.x,y-a.y);
	}
	public P scale(double a){
		return new P(x*a,y*a);
	}

	public P m(P a){//複素数積
		return new P(x*a.x-y*a.y,x*a.y+y*a.x);
	}
	public P d(P a){
		return new P(x*a.x+y*a.y,y*a.x-x*a.y).scale(1/dist2(this,O));
	}


	public static  final P Xunit=new P(1,0);
	public static  final P Yunit=new P(0,1);
	public static  final P O=new P(0,0);

	public static double norm(P a,P b){
		return Math.sqrt(dist2(a,b));
	}
	public double norm(){
		return norm(this,O);
	}
	public double dist2(P a){
		return dist2(this,a);
	}
	public static double dist2(P a,P b){
		return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
	}

	public String toString(){
		return "("+x+","+y+")";
	}
}

class C {
	P p;
	double r;
	static final double EPS=1e-10;
	C(P _p,double _r){
		p=_p;
		r=_r;
	}
	public static  final C Unit=new C(P.O,1);
	public static ArrayList<P> intersectionCC(C a,C b){
		ArrayList<P> res=new ArrayList<P>();
 		double d=P.norm(a.p, b.p);
		P diff=b.p.s(a.p).scale(1/d);
		if(a.r+b.r<d-EPS){//離れていて交点0

		}else if(d<EPS && Math.abs(a.r-b.r)<EPS){//同じ

		}else if(Math.abs(a.r-b.r)>d+EPS){//内側に含む

		}else if(Math.abs(a.r+b.r-d)<EPS){//外側で接する
			res.add(a.p.a(diff.scale(a.r)));
		}else if(Math.abs(Math.abs(a.r-b.r)-d)<EPS){//内側で接する
			res.add(a.p.a(diff.scale(a.r)));
		}else{//2点で交わる
			double rc=(d*d+a.r*a.r-b.r*b.r)/(2*d);
			double rs=Math.sqrt(a.r*a.r-rc*rc);
			res.add(a.p.a(diff.m(new P(rc,rs))));
			res.add(a.p.a(diff.m(new P(rc,-rs))));
		}
		return res;
	}
	public String toString(){
		return "P:"+p+"r:"+r;
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
#include <string>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll N;
vector<ll> g[MAX];

ll dfs(ll u) {
  vector<ll> v;
  ll i;
  ll nch=g[u].size();
  
  for(i=0; i<nch; i++) {
    v.push_back(dfs(g[u][i]));
  }
  sort(v.rbegin(), v.rend());
  
  ll res=0;
  for(i=0; i<nch; i++) {
    chmax(res, i+1+v[i]);
  }
  
  return res;
}

int main(void) {
  ll i, j, k;
  
  cin >> N;
  
  for(i=1; i<N; i++) {
    ll a;
    cin >> a;
    a--;
    g[a].push_back(i);
  }
  
  pt(dfs(0));
  
}



Measured memory_bytes: 16640
import math
N, D = map(int, input().split())
X = []

for _ in range(N):
    X.append(list(map(int, input().split())))

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        sum = 0
        for k in range(D):
            sum += (X[i][k] - X[j][k])**2
        if math.sqrt(sum).is_integer():
            cnt += 1
print(cnt)


Measured memory_bytes: 3060
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>;
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
#include<cassert>
#include<deque>
using namespace std;
int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	if(b-a==c-b)
	{
		cout << "YES";
		return 0;
	}
	cout << "NO";
	return 0;
} 

Measured memory_bytes: 256
c,t,d[4010][4010];char s[4010];i;main(j){for(**d=scanf("%s",s);s[i/2];i++)for(j=c+=s[i]?t+=2,s[i]-48:0;j>i+c-t&&~j;j--)d[i+1][j]=(d[i][j]+d[i][j-1])%998244353;printf("%d",d[i][c]);}

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

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

using namespace std;

class mint{
	static const int MOD=1e9+7;
	int x;
public:
	mint():x(0){}
	mint(long long y){ x=y%MOD; if(x<0) x+=MOD; }

	mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; }
	mint& operator-=(const mint& m){ x-=m.x; if(x<   0) x+=MOD; return *this; }
	mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; }
	mint& operator/=(const mint& m){ return *this*=inverse(m); }
	mint operator+(const mint& m)const{ return mint(*this)+=m; }
	mint operator-(const mint& m)const{ return mint(*this)-=m; }
	mint operator*(const mint& m)const{ return mint(*this)*=m; }
	mint operator/(const mint& m)const{ return mint(*this)/=m; }

	friend mint inverse(const mint& m){
		int a=m.x,b=MOD,u=1,v=0;
		while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); }
		return u;
	}

	friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=mint(t); return is; }
	friend ostream& operator<<(ostream& os,const mint& m){ return os<<m.x; }
	int to_int()const{ return x; }
};

mint pow(mint m,long long k){
	mint res=1;
	for(;k>0;k>>=1,m*=m) if(k&1) res*=m;
	return res;
}

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

	static mint dp[5001][5001]; // dp[操作回数][現在の長さ] = 場合の数
	dp[0][0]=1;
	rep(i,n) rep(l,i+1) {
		dp[i+1][l+1]+=dp[i][l]*2;
		dp[i+1][l>0?l-1:0]+=dp[i][l];
	}

	cout<<dp[n][s.length()]/pow(mint(2),s.length())<<'\n';

	return 0;
}


Measured memory_bytes: 97920
n = int(input())
s = input().strip()
l, r = 0, n-1
ans = 0
while l < r:
    if s[l] == 'R':
        l += 1
    elif s[r] == 'W':
        r -= 1
    else:
        ans += 1
        r -= 1
        l += 1
print(ans)

Measured memory_bytes: 9460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    ll q,k,m;
    char a;
    cin>>s>>q;
    ll n=s.length();
    deque<char>d;
    bool p=1;
    for(int i=0;i<n;i++)
        d.push_back(s[i]);
    while(q--){
        cin>>k;
        if(k==1){
            p=!p;
        }else{
            cin>>m>>a;
            n++;
            if(m==1)
                if(p)
                    d.push_front(a);
                else
                    d.push_back(a);
            else
                if(p)
                    d.push_back(a);
                else
                    d.push_front(a);
        }
    }
    if(p)
        for(int i=0;i<n;i++)
            cout<<d[i];
    else
        for(int i=n-1;i>=0;i--)
            cout<<d[i];
    return 0;
}

Measured memory_bytes: 976
import sys
input=sys.stdin.readline
n,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n-1)]
l2=[list(map(int,input().split())) for i in range(q)]
connection=[[] for i in range(n)]
for i in range(n-1):
  connection[l[i][0]-1].append(l[i][1]-1)
L4=[0 for i in range(n)]
for i in range(q):
  L4[l2[i][0]-1]+=l2[i][1]
distance=[0 for i in range(n)]
distance[0]=L4[0]

L=[0]
L2=[]
L3=[]
while len(L2)!=n and len(L)!=0:
  for j in range(len(L)):
    for k in range(len(connection[L[j]])):
      distance[connection[L[j]][k]]=distance[L[j]]+L4[connection[L[j]][k]]
      L3.append(connection[L[j]][k])
    L2.append(L[j])
  L=L3
  L3=[]
for i in range(len(distance)):
  print(distance[i])

Measured memory_bytes: 141220
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <utility>
#include <iterator>
#include <sstream>
#include <fstream>
#include <functional>
#include <ctime>
#include <cassert>
#include <limits>
 
using namespace std;
 
#define SyncFalse ios::sync_with_stdio(0); cin.tie(0)
#define MEM(a, v) memset(a, v, sizeof(a))
#define CLRV(a, sz, v) a.clear(); a.resize(sz, v)
#define CLR(a, sz) a.clear(); a.resize(sz)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.end(), a.begin()
#define MP make_pair
#define FI first
#define SE second
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define SZ(a) (int)a.size()
#define LNG(a) (int)a.length()
#define LPI 3.141592653589793238462643383279502884L
#define SI(n) scanf("%d", &n)
#define SL(n) scanf("%lld", &n)
#define SD(n) scanf("%lf", &n)
#define SLD(n) scanf("%llf", &n)
#define SC(n) scanf(" %c", &n)
#define SS(n) scanf("%s", n)
#define FR(i, n) for (int i = 0; i < n; i++)
#define RFR(i, n) for (int i = n - 1; i >= 0; i--)
#define FR1(i, n) for (int i = 1; i <= n; i++)
#define RFR1(i, n) for (int i = n; i >= 1; i--)
#define FOREACH(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define endl '\n'
 
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<ld> VLD;
typedef vector<double> VD;
typedef vector<bool> VB;
typedef vector<char> VC;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<int, int> PII;
typedef map<int, int> MII;
typedef map<string, int> MSI;
typedef vector<PII> VPII;
typedef vector<VPII> VVPII;
 
const double PI = acos(-1.0);
const double EPS = numeric_limits<double>::epsilon();
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const int MOD = (int) 1e9 + 7;
 
//------------------------------------------------------------------------
 
const int M = 100005;
int f[M];
 
int main() {
	int n, m; SI(n), SI(m);
	while(m--) {
		int a, b; SI(a), SI(b);
		f[a]++; f[b]++;
	}
	for (int i = 1; i <= n; ++i) {
		if (f[i] % 2 != 0) {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 640
n = int(input())
a_series = list(map(int, input().split()))
q = int(input())
bc = []
for i in range(q):
    bc.append(list(map(int, input().split())))

summed = sum(a_series)
num = [0 for i in range(100005)]

for a in a_series:
    num[a] += 1

for i in range(q):
    summed += ((bc[i][1] - bc[i][0]) * num[bc[i][0]])
    num[bc[i][1]] += num[bc[i][0]]
    num[bc[i][0]] = 0
    print(summed)


Measured memory_bytes: 32304
#include <stdio.h>

int main(){


  /*1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
    2   flag = 1 // 逆の隣接要素が存在する
    3   while flag
    4     flag = 0
    5     for j が N-1 から 1 まで
    6       if A[j] < A[j-1]
    7         A[j] と A[j-1] を交換
    8         flag = 1
  */


  int n ,i ,j,c=0 , t;
  scanf("%d" ,&n);
  int arr[n];
  for ( i = 0; i < n; i++){
    scanf("%d",&arr[i]);
  }
  
  int flag = 1 ;
  while ( flag){
    flag = 0;
    for ( i = n - 1 ;  i >= 1; i--){
      if ( arr[i] < arr[ i-1 ]){
	t = arr[i]; arr[i] = arr[ i-1 ]; arr[i-1] = t;
	c++;
	flag = 1;
      }
    }
  }

  for ( i = 0; i < n; i++){
    printf("%d",arr[i]);
    if ( i == n-1){printf("\n%d\n",c);}
    else {printf(" ");}
  }
  
  return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string b;
    for (; n != 0; n /= -2)
    {
        if (n % 2 == 0)
        {
            b.push_back('0');
        }
        else
        {
            b.push_back('1');
            n -= 1;
        }
    }
    if (b.size() == 0)
    {
        b.push_back('0');
    }
    reverse(b.begin(), b.end());
    cout << b << endl;
}

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

int a[102];

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

	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> ls(n);
  rep(i, n) cin >> ls[i];
  sort(ls.begin(), ls.end());
  ll count = 0;
  for (int i = 0; i <= n - 3; i++) {
    for (int j = i + 1; j <= n - 2; j++) {
      for (int k = n - 1; j < k; k--) {
        int a = ls[i], b = ls[j], c = ls[k];
        if (c < a + b) {
          count++;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3588
n = int(input())
s = [input() for _ in range(n)]
a = 0
b = 0
ab = 0
ans = 0
for i in range(n):
    ans += s[i].count('AB')
    if s[i][-1]=='A' and s[i][0]=='B':
        ab += 1
        continue
    if s[i][-1]=='A':
        a += 1
    if s[i][0]=='B':
        b += 1
if ab==0:
    ans += min(a,b)
elif a+b>0:
    ans += ab+min(a,b)
else:
    ans += ab-1
print(ans)

Measured memory_bytes: 44504
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define fi first
#define se second
const int inf = 1e9;

int a[200002], b[200002], c[200002];
signed main(){
	int n, ans = 0;
	scanf("%lld", &n);
	rep(i,n)scanf("%lld", &a[i]);
	rep(i,n)scanf("%lld", &b[i]);
	rep(k,30){
		int t = 1<<k, cnt = 0;
		rep(i,n)c[i] = b[i]%(2*t);
		sort(c, c+n);
		rep(i,n){
			int x = a[i]%(2*t);
			cnt += lower_bound(c, c+n, 2*t-x)-lower_bound(c, c+n, t-x);
			cnt += lower_bound(c, c+n, 4*t-x)-lower_bound(c, c+n, 3*t-x);
		}
		ans |= (cnt%2)<<k;
	}
	printf("%lld\n", ans);
	return 0;
}

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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

//---------------------------

ll MAX = 200010;
VL num(MAX, 0);

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

    VL A(n,0);
    rep(i,n){
        ll a;
        cin >> a;
        A[i] = a;
        num[a]++;
    }

    ll total = 0;
    rep(i,MAX){
        total += num[i]*(num[i]-1)/2;
    }
    // cout << total << endl;
    
    rep(i,n){
        ll ai = A[i];
        ll old = num[ai]*(num[ai]-1)/2;
        ll neww = (num[ai] - 1)*(num[ai] - 2)/2;
        cout << total - old + neww << endl;
    }

    return 0;
}

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

using namespace std;

int main()
{
  int n;
  cin>>n;
  int ans = n % 10;
  if(ans == 2 || ans == 4 || ans == 5 || ans == 7 || ans == 9)
    cout<<"hon\n";
  else if(ans == 3)
    cout<<"bon\n";
  else
    cout<<"pon\n";
  return 0;
}

Measured memory_bytes: 3592
#include<iostream>

using namespace std;

int main(){
  long long n;
  long long cnt =1;
  bool isup;
  long long cur,pre;

  cin>>n>>pre;
  while(cin>>cur){
    if(pre != cur){
      if(pre<cur){
        isup=true;
      }else{
        isup=false;
      }
      pre = cur;
      break;
    }
    pre = cur;
  }



  while(cin>>cur){
    if(pre<cur){
      if(!isup){
        cnt++;
        pre = cur;
        while(cin>>cur){
          if(pre != cur){
            if(pre<cur){
              isup=true;
            }else{
              isup=false;
            }
            pre = cur;
            break;
          }
          pre = cur;
        }
        //cout<<"up   "<<pre<<" "<<cur<<endl;
      }
    }else if(pre>cur){
      if(isup){
        cnt++;
        pre = cur;
        while(cin>>cur){
          if(pre != cur){
            if(pre<cur){
              isup=true;
            }else{
              isup=false;
            }
            pre = cur;
            break;
          }
          pre = cur;
        }
        //cout<<"down "<<pre<<" "<<cur<<endl;
      }
    }
    pre = cur;

  }

  cout<<cnt<<endl;

  return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for(auto &a : A) cin >> a;
    sort(A.begin(), A.end());
    int ans = 0;
    rep(i, 101010) {
        int n = lower_bound(A.begin(), A.end(), i) - A.begin();
        ans += (N == 2 * n);
    }
    cout << ans << '\n';
    return 0;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

//約数
void divisor(ll n, vector<ll> &ret) {
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
}

void solve() {
    ll n;
    cin >> n;
    ll ans = 0;
    rep(i, 1, n + 1) {
        if(i % 2) {
            vec<ll> ret;
            divisor(i, ret);
            if(ret.size() == 8) {
                ans++;
            }
        }
    }
    cout << ans << en;
}

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

    solve();

    /*
    ll t;
    cin >> t;
    REP(i, t) { solve();}
    */

    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int e=8111000;
int w[e],v[e];
long long f[8101000];
int main(){
	int n,W;
	cin>>n>>W;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];		
	}	
	for(int i=1;i<=n;i++)
	{
		for(int t=W;t>=w[i];t--)
		{
				f[t]=max(f[t],f[t-w[i]]+v[i]);
		}
	}
	cout<<f[W];
	return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000000LL;

int main() {
	int n,a[201],mi=1000000000;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
		int k=a[i],l=0;
		while(1){
			if(k%2>0)break;
			l++;
			k/=2;
		}
		mi=min(mi,l);
	}

	cout<<mi<<endl;
	return 0;
}


Measured memory_bytes: 256
module Main where

import Numeric
import Data.Functor

main :: IO ()
main =  do
  { [a,b,ab] <- getDoubles
  ; let ang = pi * ab / 180
  ; let sine = sin ang
  ; let cosine = cos ang
  ; let h = b * sine
  ; let s = a * h / 2
  ; let a2pb2 = a^2 + b^2
  ; let ab2 = 2 * a * b
  ; let c2 = a2pb2 - ab2 * cosine
  ; let c = sqrt c2
  ; putStr $ unlines $ map (flip (showFFloat Nothing) "") [s,a+b+c,h]
  }

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

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

int main() {
	int n;
	cin>>n;
	double o;
	vector<double> dp(n+1,0);
	dp[0]=1;
	for(int i=0;i<n;i++){
		cin>>o;
		for(int j=i+1;j>=0;j--){
			dp[j]=(j==0?dp[j]*(1-o):dp[j-1]*o+dp[j]*(1-o));
		}
	}
	o=0;
	for(int i=n;i>=(n+1)/2;i--)
	o+=dp[i];
	cout<<fixed<<setprecision(10)<<o;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>

using namespace std;

int main() {
	int x, y, men, syu;
	cin >> x >> y;

	men = x*y;

	x = 2 * x;
	y = 2 * y;

	syu = x + y;

	cout << men << " " << syu << endl;

	return 0;

}


Measured memory_bytes: 2972
#include <bits/stdc++.h>
#define N 200010
#define mod 1000000007
using namespace std;

inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
inline void Add(int &x,int y)
{
	x+=y; if(x>=mod) x-=mod;
	if(x<0) x+=mod;
}
struct mat
{
	int p,q;
	int m[5][5];
}ans,bb,ss;
mat operator *(mat a,mat b)
{
	mat tmp; 
	memset(tmp.m,0,sizeof tmp.m);
	tmp.p=a.p; tmp.q=b.q;
	for(int i=0;i<a.p;i++)
		for(int j=0;j<b.q;j++)
			for(int k=0;k<a.q;k++)
				Add(tmp.m[i][j],1ll*a.m[i][k]*b.m[k][j]%mod);
	return tmp;
}
mat qpow(mat bas,int pw)
{
	mat tmp; 
	memset(tmp.m,0,sizeof tmp.m);
	tmp.p=4; tmp.q=4;
	for(int i=0;i<4;i++) tmp.m[i][i]=1;
	for(;pw;pw>>=1,bas=bas*bas)
		if(pw&1) tmp=tmp*bas; 
	return tmp;
}
int n,m,X[N];
int main()
{
	n=read(); m=read(); 
	for(int i=1;i<=m;i++) X[i]=read();
	ans.p=1; ans.q=4;
	ans.m[0][0]=1;
	bb.p=ss.p=4; bb.q=ss.q=4;
	ss.m[0][0]=ss.m[0][1]=ss.m[0][2]=ss.m[0][3]=1;
	ss.m[1][1]=ss.m[1][3]=ss.m[2][2]=ss.m[2][3]=1;
	ss.m[3][3]=1; bb=ss;
	for(int i=0;i<4;i++) bb.m[3][i]++;
	ans=ans*bb;
	for(int i=1;i<=m;i++)
		ans=ans*qpow(bb,X[i]-X[i-1]-1)*ss;
	ans=ans*qpow(bb,n-X[m]-1);
	cout << ans.m[0][3] << endl;
	return 0;
}

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

using namespace std;

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

void solve() {
  int a, b;
  cin >> a >> b;
  if(a > b) swap(a, b);
  if(a == 1) {
    if(b == 1) cout << 1 << endl;
    else cout << b-2 << endl;
    return;
  }
  cout << (a-2LL) * (b-2LL) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}


Measured memory_bytes: 256
#pragma region header
#define _GLIBCXX_DEBUG 
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
signed main() {
    int N;
    cin>>N;

    for(int i=0;i<N;i++){
        cout<<"ACL";
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string>) {}
template<typename T1,typename T2> ostream& operator<<(ostream& os, pair<T1,T2> buf) {
  return os << "(" << buf.first << ": " << buf.second << ")"; }
#define DefOut(Con) template<typename T>ostream&operator<<(ostream&os,Con<T>&A){ bool f = false; os << "{"; \
  for (const auto e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
#define DefOut2(Con) template<typename K,typename V>ostream&operator<<(ostream&os,Con<K,V>&A) \
{ bool f = false; os << "{"; for (auto &e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
template<typename T>ostream &operator << (ostream &os,vector<vector<T>>& A) {
  for (auto &B: A) os << '\n' << B; return os; }
DefOut(vector) DefOut(set) DefOut(multiset) DefOut2(map) 
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1000000007;
long long const INF = 1e18;
#define PI 3.14159265358979323846
/***********************************************************************/

int32_t main() {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, x;
  cin >> n >> x;
  int ans = 1, cur = 0;
  for (int i = 0; i < n; ++i) {
    int u; cin >> u;
    cur += u;
    ans += cur <= x;
  }
  kek(ans);
  
  return 0;
}


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

using namespace std;
typedef long long ll;
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define pii pair<int,int>
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define mod 1000000007
ll x,y,z,n,m,k,s=0,l=0,r=0,ans=0,cnt=0,a[1000],b[1000];
vector<ll> vec;
vector<pll> vecp;
set<ll> st;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3);
ans=a[2]*10+a[1]+a[0];
cout<<ans<<endl;

return 0;
}


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

int main(){
int n;
cin >> n;
int ans =0;
long long l[n+1];
for(int i=0;i<n;i++){
  cin >> l[i];
}

for(int i=0;i<n;i++){
  for(int j=i+1;j<n;j++){
    for(int k=j+1;k<n;k++){
      if(l[i]!=l[j]&&l[j]!=l[k]&&l[k]!=l[i]&&abs(l[i]-l[j]) <l[k] && abs(l[j]-l[k]) <l[i] && abs(l[k]-l[i]) < l[j]){
          ans +=1;
        }
    }
  }
}

cout << ans <<endl;
}

Measured memory_bytes: 3632
from itertools import combinations

def comb(L,num):
    return list(combinations(L,num))

while True:
    n,x = map(int,input().split())
    if n==0 and x==0:
        exit()
    
    n_L = range(1,n+1)
    ans = 0
    for i in comb(n_L,3):
        if sum(i) == x:
            ans += 1
    
    print(ans)


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

int main() {
	ll N,x,t,d,s=0;
	cin >> N >> x;
	vector<ll> a(N);
	rep(i,N)
		cin >> a.at(i);
	
	t = a.at(0);
	rep(i,N-1) {
		t += a.at(i+1);

		if(t > x) {
			d = t-x;
			s += d;
			t -= min(a.at(i+1), d);
			a.at(i+1) -= d;
			a.at(i+1) = max(a.at(i+1), 0ll);
		}
		
		t -= a.at(i);
	}

	cout << s << endl;
}

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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

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

const ll max_d = 50;
ll f(ll x){
  if(x == -1) return 0;
  //0, 1, ..., xの排他的論理和を求める
  ll ans;
  //1の桁は特別
  (x % 4 == 1 || x % 4 == 2) ? ans = 1 : ans = 0;
  //(1 << k)の桁
  REP(i, 50){
    if(((x >> (i + 1)) & 1) && !(x & 1)) ans += (1ll << (i+1));
  }
  return ans;
}

int main(){
  ll a, b;
  cin >> a >> b;
  cout << (f(a-1) ^ f(b)) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>

int main(void) {
	int a, b, c, d = 0;
	
	 scanf("%d%d%d%d", &a, &b, &c, &d);
	 printf("%.f", fmax(0, fmin(b, d) - fmax(a, c)));
	return 0;
}

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

int main() {
  int a,b,k;
  cin >>a>>b>>k;
  vector<int> ans(100);
  int x=0;
  for (int i = 0; i < 100; i++) {
    
  	if(a%(100-i)==0 && b%(100-i)==0){
    ans.at(x)=100-i;
      x++;
    
    }
  
  }
 
  cout << ans.at(k-1) << endl;
}


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

using namespace std;

const int maxn = 2e5 + 10;
int a[maxn] , n;
int main(){
    cin >> n;
    for(int i = 1 ; i <= n ; ++ i){
        cin >> a[i];
        a[i] -= i;
    }
    sort(a + 1 , a + n + 1);
    int v = a[(n + 1) / 2];
    long long ans = 0;
    for(int i = 1 ; i <= n ; ++ i)
        ans += abs(a[i] - v);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int q[101000],H=0,T=0;
int col[101000],d[101000];
int h[101000],nxt[201000],to[201000],K=0;
int V[101000],D[101000],C[101000];
void ins(int u,int v){nxt[++K]=h[u];h[u]=K;to[K]=v;}
int main()
{
	int n,m;scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int a,b;scanf("%d%d",&a,&b);
		ins(a,b);ins(b,a);
	}
	int Q;scanf("%d",&Q);
	for(int i=1;i<=Q;i++)scanf("%d%d%d",&V[i],&D[i],&C[i]);
	memset(d,-1,sizeof(d));
	for(int i=Q;i>=1;i--)
	{
		if(D[i]>d[V[i]])
		{
			H=T=0;d[V[i]]=D[i];q[T++]=V[i];
			while(H<T)
			{
				int x=q[H++];if(!col[x])col[x]=C[i];
				for(int j=h[x];j;j=nxt[j])
				{
					if(d[to[j]]<d[x]-1)
					{
						d[to[j]]=d[x]-1;
						q[T++]=to[j];
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++)printf("%d\n",col[i]);return 0;
 } 

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define debug(v) for (auto el : v) { cerr << el << ' '; } cerr << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	double t, x;
	cin >> t >> x;
	cout << (t/x) << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();

        Map<Long, List<Person>> map = new HashMap<>();

        long count = 0;
        for (long id = 1; id <= n; id++) {
            long height = scanner.nextLong();
            Person person = new Person(id, height);
            if (!map.containsKey(person.calc())) {
                map.put(person.calc(), new ArrayList<>());
            }
            map.get(person.calc()).add(person);

            long target = id - person.height;
            if (map.containsKey(target)) {
                count += map.get(target).size();
            }
        }
        System.out.println(count);
    }

    static class Person {
        long id;
        long height;

        public Person(long id, long height) {
            this.id = id;
            this.height = height;
        }

        public long calc() {
            return this.id + this.height;
        }

        @Override
        public String toString() {
            return id + ":" + height;
        }
    }
}

Measured memory_bytes: 96236
n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]


def dfs(i, a, b, c):
    if n == i:
        if 1 > a or 1 > b or 1 > c:
            return 10 ** 18
        return abs(A-a) + abs(B-b) + abs(C-c)
    res = dfs(i + 1, a, b, c)
    res = min([res, dfs(i + 1, a + l[i], b, c) + (10 if a > 0 else 0)])
    res = min([res, dfs(i + 1, a, b + l[i], c) + (10 if b > 0 else 0)])
    res = min([res, dfs(i + 1, a, b, c + l[i]) + (10 if c > 0 else 0)])
    return res


print(dfs(0, 0, 0, 0))


Measured memory_bytes: 3064
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <vector>

int main(){
  int N;
  scanf("%d", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<int > A(N);
  for (int i=0; i<N; i++){
    scanf("%d", &A[i]);
    A[i]--;
  }
  std::vector<int > count(N+4, -1);
  int idx=0;
  int num=0;
  while(count[idx]==-1){
    //printf("idx=%d\n", idx);
    count[idx]=num;
    idx=A[idx];
    num++;
    if (K==num){
      printf("%d\n",idx+1);
      return 0;
    }
  }
  //printf("while end\n");
  int index=idx;
  int first = count[index];
  int next = num;
  int k=(K-next)%(next-first);

  for (int i=0; i<k; i++){
    index=A[index];
  }
  std::cout << index+1 << std::endl;
  return 0;
}


Measured memory_bytes: 4488
#include<iostream>

using namespace std;

int main()
{
	int x1,x2,y1,y2;
	cin>>x1>>y1>>x2>>y2;
	int dx=x2-x1;
	int dy=y2-y1;
	int x3=x2-dy,y3=y2+dx,x4=x1-dy,y4=y1+dx;
	cout<<x3<<' '<<y3<<' '<<x4<<' '<<y4<<endl;
	return 0;
}

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

#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

int L[MAX/2+2], R[MAX/2+2];

llong merge(int A[], int n, int left, int mid, int right){
  llong cnt = 0;
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for (i=0; i<n1; i++) L[i] = A[left+i];
  for (i=0; i<n2; i++) R[i] = A[mid+i];
  i = j = 0;
  L[n1] = R[n2] = SENTINEL;
  for (k=left; k<right; k++){
    if (L[i] <= R[j]){
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
      cnt += n1 - i;
    }
  }
  return cnt;
}

llong mergeSort(int A[], int n, int left, int right){
  int mid;
  llong v1, v2, v3;
  if (right - left > 1){
    mid = (left + right) / 2;
    v1 = mergeSort(A, n, left, mid);
    v2 = mergeSort(A, n, mid, right);
    v3 = merge(A, n, left, mid, right);
    return v1 + v2 + v3;
  } else return 0;
}

int main(){
  int n, A[MAX];

  cin >> n;
  for (int i=0; i<n; i++){
    cin >> A[i];
  }

  llong ans = mergeSort(A, n, 0, n);

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 4644
#include <stdio.h>
#include <stdlib.h>
int compare(const void *a,const void *b){
    return *(int*)b-*(int*)a;
}

main(){
  int n, s;
  scanf("%d", &n);
  int L[n];
  for(int i=0; i<n; i++) scanf("%d", &L[i]);
  
  qsort(L,n,sizeof(int),compare);
  
  for(int i=0; i<n-2; i++){
    for(int j=i+1; j<n-1; j++){
      for(int k=j+1; k<n; k++){
        if(L[i]<L[j]+L[k]){
          s++;
        }
        else break;
      }
    }
  }
  printf("%d", s);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

int main() {
    int N;
    std::cin >> N;

    std::vector<int> v(N);
    for (int i = 1; i < N; i++) {
        int A;
        std::cin >> A;
        v[A - 1]++;
    }

    for (int i = 0; i < N; i++)
        std::cout << v[i] << "\n";
}

Measured memory_bytes: 4056
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
string ItoS(int );
int StoI(string );
int b[1000000],d[1000000],l;

int main(){
  while(1){
    int a;
    cin>>a>>l;
    if(a+l==0)break;
    memset(b,0,sizeof(b));
    int count=0,count1=0;

    while(1){
      //      cout<<a<<endl;
      if(b[a]==1)break;
      b[a]=1;
      count++;
      d[a]=count;
      string r=ItoS(a);
      string r1=r;
      reverse(r1.begin(),r1.end());
      int c=StoI(r);
      int c1=StoI(r1);
      a=c1-c;
    }
    cout<<d[a]-1<<' '<<a<<' '<<count-d[a]+1<<endl;
  }
  return 0;
}


string ItoS(int x){
  string str;
  while(x){
    str+=x%10+'0';
    x/=10;
  }
  for(int i=str.size();i<l;i++)str+='0';
  sort(str.begin(),str.end());
  return str;
  }

int StoI(string s){
  int r=0;
  for(int i=0;i<s.size();i++)
    r=r*10+s[i]-'0';
  return r;
}

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

#define IN(i,l,r) (l<i&&i<r)
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)

#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FFE(i,L,R) for (int i = L; i >= R; i--)

#define wez(n) int (n); cin >> n
#define wez2(n,m) int (n),(m); cin >> n >> m
#define wez3(n,m,k) int (n),(m),(k); cin >> n >> m >> k

#define whileZ int T; cin >> T; while(T--)

#define ALL(c) (c).begin(),(c).end()
#define ll long long 
#define ull unsigned long long
#define ld long double

#define fi first
#define se second

// for debug
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
#define printV(a) if(a.size()) printA(a,0,a.size()-1)

#define pb push_back
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> ii;
//  priority_queue <int, vector<int>, greater<int> > pq; // min heap

// Smallest Prime Factor in O(nloglogn)
const int MAXN = 1000010 ; 
int spf[MAXN]; 
void sieve() { 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++)   spf[i] = i; 
    for (int i=4; i<MAXN; i+=2)  spf[i] = 2; 
    for (int i=3; i*i<MAXN; i++) { 
        if (spf[i] == i) { 
            for (int j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 

vi getdp (int x) {
    vi ret;
    while (spf[x] > 1) {
        ret.pb(spf[x]);
        x /= spf[x];
        while (spf[x] > 1 && spf[x] == ret.back())
            x /= spf[x];
    }
    return ret;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    sieve();

    wez(n);
    int g = 0;
    vi v(n);

    F(i,0,n) {
        cin >> v[i];
        g = __gcd(g, v[i]);
    }
    if (g > 1) {
        cout << "not coprime\n";
        return 0;
    }

    set <int> s;
    for (int x: v) {
        vi dp = getdp(x);
        for (int fac: dp) {
            if (s.count(fac)) {
                cout << "setwise coprime\n";
                return 0;
            }
            s.insert(fac);
        }
    }
    
    cout << "pairwise coprime\n";
    return 0;
}

Measured memory_bytes: 11200
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ABC135
{
    class Program3
    {
        static void Main()
        {
            var N = int.Parse(Console.ReadLine());
            var str = Console.ReadLine();
            var A = str.Split(' ').Select(int.Parse).ToArray();
            str = Console.ReadLine();
            var B = str.Split(' ').Select(int.Parse).ToArray();

            if (A.Length != N + 1 || B.Length != N)
                A[N + 2] = 1;

            Decimal ans = 0;
            var remainder = 0;

            for (int i = 0; i < N; i++)
            {
                ans += Math.Min(A[i], B[i] + remainder);
                var a = Math.Max(A[i] - remainder, 0);
                remainder = Math.Max(B[i] - a, 0);
                //Console.WriteLine(remainder);
            }

            ans += Math.Min(A[N], remainder);
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 32324
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll 
a[]={1,1,1,1,-1,-1,-1,-1},
b[]={1,1,-1,-1,1,1,-1,-1},
c[]={1,-1,1,-1,1,-1,1,-1};

struct xyz{ll x,y,z;};
ll I;
bool cmp(xyz x,xyz y)
{
	ll A = a[I]*x.x+b[I]*x.y+c[I]*x.z;
	ll B = a[I]*y.x+b[I]*y.y+c[I]*y.z;
	return A > B;
}

int main()
{
	ll n,m;
	cin >> n >> m;
	vector<xyz> v(n);
	for(ll i = 0;i<n;i++)
	{
		cin >> v[i].x>>v[i].y>>v[i].z;
	}
	ll ans = 0;
	for(ll i =0 ;i<8;i++)
	{
		sort(v.begin(),v.end(),cmp);
		ll now = 0;

		for(ll j = 0;j<m;j++)
		{
			now+=v[j].x*a[I]+v[j].y*b[I]+v[j].z*c[I];
		}
		ans = max(now,ans);
		I++;
	}
	cout<<ans<<endl;

}

Measured memory_bytes: 256