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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i,n) for(ll i=0; i<(n); i++)
#define forn for(ll i=0; i<(n); i++)
#define fori(i,k,n) for(ll i=k; i<(n); i++) 
#define all(x) (x).begin(),(x).end()
#define en '\n'
#define FILL(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}
template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

void solve(){
	int n, k;
	cin >> n >> k;
	int ans = 0;
	bool ok[n];
	set<int> st;
	for(int i=0; i<k; i++){
		int c; cin >> c;
		fork(j,c){
			int t; cin>> t;
			st.insert(t);
		}
	}
	cout << n - st.size() << en;
	// forn{
	// 	if(!ok[i]) ans++;
	// }
}

int main(){
	fast;
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	solve();
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<cstdlib>

using namespace std;

int cal(int l, int r) {
  char in[81] = {};
  int i = 0;

  while(scanf("%s", in) != EOF) {

    //                  printf("l : %f, r : %f\n", l, r);
    if(in[0] == '+')       return l + r;
    else if(in[0] == '-')  return l - r;
    else if(in[0] == '*')  return l * r;
    //                  else if(in[0] == '/')  return 1.0 * l / r;
    else if(in[0] == '\n') return r;
    r = cal(r, atoi(in));
  }
  //                    printf("l : %f, r : %f\n", l, r);
  return r;
}

int main() {
  printf("%d\n", cal(0, 0));

  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

int main() {
	std::string s;
	std::cin >> s;
	std::map<char, lnt> map;
	lnt n=s.size();
	lnt ans=n*n;
	for(auto c:s) map[c]++;
	for(auto e:map) {
		ans-=e.second*e.second;
	}
	print(ans/2+1);
}


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

//#define int long long

using namespace std;

int a[100001];

int main () {
	int ans = 0;  
	string s;
	cin >> s;
	ans = s.size ();
	int kol = 0;
	for (int i = 0;i < s.size ();i ++) {
		if (s[i] == 'S') {
			kol ++;
		}
		else {
			if (kol) {
				ans -= 2;
				kol --;
			}
		}
	}
	cout << ans;
    return 0;           		
}

Measured memory_bytes: 640
from bisect import bisect_left, bisect_right
A,B,Q = map(int,input().split())
s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]
for _ in range(Q):
    x = int(input())
    a = bisect_right(s, x)
    b = bisect_right(t, x)
    la = x-s[a-1] if a > 0 else None
    ra = s[a]-x if a < A else None
    lb = x-t[b-1] if b > 0 else None
    rb = t[b]-x if b < B else None
    ans = float("inf")
    if la and lb:
        ans = min(ans, max(la, lb))
    if la and rb:
        ans = min(ans, la+2*rb, 2*la+rb)
    if ra and lb:
        ans = min(ans, ra+2*lb, 2*ra+lb)
    if ra and rb:
        ans = min(ans, max(ra, rb))
    print(ans)

Measured memory_bytes: 16956
//============================================================================
// Name        : JOI.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;

int main() {


	int a,b,c,d;
	int l=0,r=0;

	cin>>a>>b>>c>>d;

	l=a+b;
	r=c+d;

	if(l>r){
		cout<<"Left"<<endl;
	}else if(l<r){
		cout<<"Right"<<endl;
	}else if(l=r){
		cout<<"Balanced"<<endl;
	}





}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		(1<<29)
#define MINF		-2000000007
#define MAX 		205

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

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

	int A[4];
	REP(i,4)A[i]=s[i]-'0';

	REP(i,(1<<3)){
		int ans=A[0];
		REP(j,3)ans += (i&(1<<j) ? A[j+1] : -A[j+1]);
		if(ans == 7){
			cout << A[0];
			REP(j,3){
				cout << (i&(1<<j) ? '+' : '-');
				cout << A[j+1];
			}
			cout << "=7" << endl;
			break;
		}
	}

	return 0;
}




Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,cnt=0,bc=0;
  string s;
  cin >> s;
  n = s.size();
  for(int i=0;i<n;i++){
    if(s[i]=='B')bc++;
    else{
      cnt += bc;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='1')
		cout<<'9';
		else
		cout<<'1';
	}
	return 0;
}

Measured memory_bytes: 256
A, B = [int(i) for i in input().split()]


def xor(a,b):
    sum=0
    i=0
    while(b>0):
        sum += (2**i) * ((a%2 + b%2)%2)
        a = a//2
        b = b//2
        i += 1
    return sum



def f(n):
    m=(n+1)//2
    if n%2==0:
        if m%2==0:
            return n
        else:
            return n+1
    else:
        if m%2==0:
            return 0
        else:
            return 1

if A==0:
    print(f(B))
else:
    print(f(A-1) ^ f(B))


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

int main(){
	string s,t;
  	cin>>s>>t;
  int minswaps=INT_MAX;
  	for(int i=0;i+t.length()<=s.length();i++){
    	int swaps=0;
      	for(int j=0;j<t.length();j++){
        	if(s[i+j]!=t[j]){
            	swaps++;
            }
        }	
      	minswaps=min(swaps,minswaps);
    }
   cout<<minswaps<<endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
ll cnt[100005];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	ll val=0;
	for(ll i=1;i<n;i+=2){
		val = val^(a[i]^a[i-1]);
	}
	ll ans[n];
	for(ll i=0;i<n;i++){
		ans[i] = val^a[i];
	}
	for(ll i=0;i<n;i++) cout<<ans[i]<<" ";
	
	
	
	
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    if(n == 0){
        cout << 0 << endl;
        return 0;
    }
    vector<unsigned long long> v;
    v.reserve(n);
    for(int i = 0; i < n; i++){
        unsigned long long x;
        cin >> x;
        if(x == 0){
            cout << 0 << endl;
            return 0;
        }
        v.push_back(x);
    }
    unsigned long long prod = 1;
    for(int i = 0; i < n; i++){
        if(v[i] <= 1000000000000000000 / prod){
            prod *= v[i];
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << prod << endl;
}


Measured memory_bytes: 4040
N,K = gets.chomp.split(" ").map(&:to_i)
A = gets.chomp.split(" ").map(&:to_i)
total = {}
A.each do |i|
  unless total[i]
    total[i] = 1
  else
    total[i] = total[i] + 1
  end
end
sum = 0
total = total.values
total = total.sort {|a, b| b <=> a }
K.times do |i| # 2
  if total[i]
    sum = sum + total[i]
  end
end
p N-sum

Measured memory_bytes: 34160
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int A[N];
  REP(i,N)cin>>A[i];
  string ans="APPROVED";
  REP(i,N){
    if(A[i]%2==0){
      if(A[i]%3 and A[i]%5)ans="DENIED";
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

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

using namespace std;

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

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

signed main(){
	int n,r;
	cin>>n>>r;
	if(n>=10)cout<<r<<endl;
	else cout<<r+100*(10-n)<<endl;
}

Measured memory_bytes: 256
import queue
n = int(input())

node = [[] for _ in range(n)]
color = [-1] * n
color[0] = 0

for _ in range(n-1):
    u, v, w = map(int, input().split())
    node[u-1].append((v-1, w))
    node[v-1].append((u-1, w))

q = queue.Queue()
q.put(0)

while not q.empty():
    i = q.get()
    c = color[i]
    for j, w in node[i]:
        if color[j] < 0:
            color[j] = c if w % 2 == 0 else (c + 1) % 2
            q.put(j)

for c in color:
    print(c)
    

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

using namespace std;

typedef long long ll;

#define debug(x) cout << #x << " : " << x << '\n';


// code //
const int N = 100100;
int n;
int a[N], b[N], c[N];
int dp[N][3];


int main() {
	cin >> n;
	for(int i = 0; i < n; ++i) 
		cin >> a[i] >> b[i] >> c[i];

	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i = 1; i < n; ++i) {
		dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1]);
	}

	cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
}

Measured memory_bytes: 5860
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  ll res = 1e18;
  if (x[0] >= 0) {
    res = x[k-1];
  }
  else if (x[n-1] <= 0) {
    res = abs(x[n-k]);
  }
  else {
    for (int i = 0; i <= n-k; i++) {
      ll sum = 0;
      if (x[i] < 0 && x[i+k-1] > 0) {
	sum += min(abs(x[i]), abs(x[i+k-1]));
      }
      sum += x[i+k-1]-x[i];
      res = min(res, sum);
    }
  }
  dump(res);
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)

typedef long long LL;
const int N=100005;

struct edge {int y,w,next;} e[N*2];

int mx[N],size[N],rt,rt2;
int ls[N],edCnt,n;

LL dis[N];

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):(v),ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void add_edge(int x,int y,int w) {
	e[++edCnt]=(edge) {y,w,ls[x]}; ls[x]=edCnt;
	e[++edCnt]=(edge) {x,w,ls[y]}; ls[y]=edCnt;
}

void dfs(int x,int fa) {
	size[x]=1;
	for (int i=ls[x];i;i=e[i].next) {
		if (e[i].y==fa) continue;
		dis[e[i].y]=dis[x]+e[i].w;
		dfs(e[i].y,x); size[x]+=size[e[i].y];
		mx[x]=std:: max(mx[x],size[e[i].y]);
	}
	mx[x]=std:: max(mx[x],n-size[x]);
	if (mx[x]<mx[rt]) rt=x;
}

int main(void) {
	n=read();
	rep(i,2,n) {
		int x=read(),y=read(),w=read();
		add_edge(x,y,w);
	}
	mx[rt]=n;
	dfs(1,0);
	dis[rt]=0;
	dfs(rt,0);
	LL ans=0,sum=0; bool flag=false;
	rep(i,1,n) sum+=dis[i]*2;
	for (int i=ls[rt];i;i=e[i].next) {
		if (mx[e[i].y]==mx[rt]) {
			ans=sum-e[i].w;
			flag=true;
		}
	}
	if (!flag) rep(i,1,n) if (i!=rt) {
		ans=std:: max(ans,sum-dis[i]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8448
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

def point(i, hand):
    if   T[i] == 'r' and hand == 'p':
        return P
    elif T[i] == 's' and hand == 'r':
        return R
    elif T[i] == 'p' and hand == 's':
        return S
    return 0

dp = [{'r': 0, 's': 0, 'p': 0} for _ in range(N)]

for i in range(N):
    if i - K < 0:
        dp[i]['r'] = point(i, 'r')
        dp[i]['s'] = point(i, 's')
        dp[i]['p'] = point(i, 'p')
    else:
        dp[i]['r'] = point(i, 'r') + max(dp[i-K]['s'], dp[i-K]['p'])
        dp[i]['s'] = point(i, 's') + max(dp[i-K]['r'], dp[i-K]['p'])
        dp[i]['p'] = point(i, 'p') + max(dp[i-K]['r'], dp[i-K]['s'])

ans = 0
for i in range(N - K, N):
    ans += max(dp[i]['r'], dp[i]['s'], dp[i]['p'])

print(ans)


Measured memory_bytes: 88412
using System;
using System.Linq;
using System.Collections.Generic;

namespace program
{
    class Program
    {
        static void Main()
        {
          string[] A = Input.ScanStrArray();
          int s = Convert.ToInt32(A[0],16);
          int t = Convert.ToInt32(A[1],16);
          if(s==t)
	          Console.WriteLine("=");
          else if(s<t)
            Console.WriteLine("<");
          else
            Console.WriteLine(">");
            
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll h, w;
    cin >> h >> w;

    vector<vector<char>> board(h+2, vector<char>(w+2));
    exrep(i, 1, h) {
        exrep(j, 1, w) {
            cin >> board[i][j];
        }
    }

    exrep(j, 0, w+1) {
        board[0][j] = '#';
    }
    exrep(i, 0, h+1) {
        board[i][0] = '#';
    }
    exrep(j, 0, w+1) {
        board[h+1][j] = '#';
    }
    exrep(i, 0, h+1) {
        board[i][w+1] = '#';
    }

    rep(i, h+2) {
        rep(j, w+2) {
            cout << board[i][j];
        }
        cout << "\n";
    }
    
    re0;
}

Measured memory_bytes: 256
h = int(input())
H = list(map(int,input().split()))
for i in range(h):
    node = i+1
    print(f"node {node}: ",end = "")
    key = H[i]
    print(f"key = {key}, ",end = "")
    if 1 <= node//2 <= h:
        parent_key = H[node//2-1]
        print(f"parent key = {parent_key}, ",end = "")
    if 1 <= node*2 <= h:
        left_key = H[node*2-1]
        print(f"left key = {left_key}, ",end = "")
    if 1 <= node*2+1 <= h:
        right_key = H[node*2]
        print(f"right key = {right_key}, ",end = "")
    print()


Measured memory_bytes: 5732
N,Limit = (int(T) for T in input().split())
Flag = False
CostMax = 1001
for R in range(0,N):
    Cost,Time = (int(T) for T in input().split())
    if Time<=Limit and Cost<CostMax:
        CostMax = Cost
        Flag = True
print(['TLE',CostMax][Flag])

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

#if DEBUG && !ONLINE_JUDGE
  #include "header.h"
#else
  #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  preprocess();
  int n, r; cin>>n>>r;
  if(n>=10) {
    cout<<r<<endl;
  }
  else {
    cout<<r+100*(10-n)<<endl;
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b){
  if(a%b==0) return b;
  return gcd(b, a%b);
}

int main(){
  int n;  cin >> n;
  vector<ll> t(n);
  ll times=1;
  for(int i=0; i<n; i++) cin >> t.at(i); 
  
  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      ll chk = gcd(t[i], t[j]);
      if(chk==1) continue;
      t[j] /= chk;
    }
  }
  for(int i=0; i<n; i++)  times *= t[i];
  cout << times << endl;
  
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;


ll solve(ll n, vector<ll> befRate, vector<ll> aftRate){
  vector<ll> dp(n+1, 0); // dp[N] = nextN
  rep(i, n+1){
    ll maxx = i;
    rep(t, 3){
      if(befRate[t] <= i) maxx = max(maxx, dp[i - befRate[t]] + aftRate[t]);
    }
    dp[i] = maxx;
  }

  return dp[n];
}

int main(){
  ll n;
  cin >> n;
  ll ka, ga, da, kb, gb, db;
  cin >> ka >> ga >> da;
  cin >> kb >> gb >> db;

  vector<ll> rateA = {ka, ga, da};
  vector<ll> rateB = {kb, gb, db};

  auto nn = solve(n, rateA, rateB);
  auto nnn = solve(nn, rateB, rateA);

  cout << nnn << endl;


  return 0;
}


Measured memory_bytes: 195584
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 2e5+5;
//inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

int _;

int main()
{
  //fastio();
  double r;
  scanf("%lf",&r);
  printf("%.8f\n",r*2*acos(-1));
  return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<int> p(n);
    rep (i, n) cin >> p[i];
    vector<int> graph[n];
    rep (i, m) {
        int x, y; cin >> x >> y;
        x--; y--;
        graph[x].push_back(y);
        graph[y].push_back(x);
    }
    vector<bool> used(n);
    int ans = 0;
    rep (i, n) {
        if (used[i]) continue;
        used[i] = true;
        priority_queue<int> q;
        map<int, int> a, b;
        q.push(i);
        while (!q.empty()) {
            int j = q.top(); q.pop();
            // eprintf("%d ", j);
            a[p[j]]++; b[j + 1]++;
            for (int k : graph[j]) {
                if (!used[k]) {
                    used[k] = true;
                    q.push(k);
                }
            }
        }
        for (P z : a) eprintf("(%d,%d)", z.first, z.second); eprintf("\n");
        for (P z : b) eprintf("(%d,%d)", z.first, z.second); eprintf("\n");
        for (P z : a) ans += min(z.second, b[z.first]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 15488
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;

// debug
template <class T> ostream& operator<<(ostream &s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream &s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream &s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;

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

signed main() {
  int n; cin >> n;
  vector<int> a(n); REP (i, n) cin >> a[i], a[i] = -a[i];
  reverse(ALL(a));
  vector<int> dp(n, 1e17), sum(n + 1, -1);
  REP (i, n) {
    int idx = lower_bound(ALL(dp), a[i]) - dp.begin();
    dp[idx] = a[i];
    chmax(sum[idx], (idx == 0 ? 0 : sum[idx - 1]) - a[i]);
  }
  REP (i, n + 1) {
    if (sum[i] == -1) {
      cout << sum[i - 1] << endl; return 0;
    }
  }
}



Measured memory_bytes: 5176
use std::io;
use std::cmp::min;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let w = v[0];
	let a = v[1];
	let b = v[2];
	if (b >= a && b <= a+w) || (b+w >= a && b+w <= a+w){
		println!("0");
	}else{
		println!("{}", min((b-(a+w)).abs(), (a-(b+w)).abs()));
	}
}

Measured memory_bytes: 4352
#include<stdio.h>

#include<queue>
#include<iostream>

using namespace std;

enum
{
	wide, high,
	none = 0
};

#define BLOCK_WIDE 2
#define BLOCK_HIGH 4

void HighBlock(char map[100 +2][100 +2] ,int color, int x, int y)
{
	int i = y, j;
	y += BLOCK_HIGH;
	while (i < y)
	{
		j = x;
		while (j < x + BLOCK_WIDE)
		{
			map[i][j++] = color;
		}

		++i;
	}
}

void WideBlock(char map[100 +2][100 +2] ,int color, int x, int y)
{
	int i = y, j;
	y += BLOCK_WIDE;
	while (i < y)
	{
		j = x;
		while (j < x + BLOCK_HIGH)
		{
			map[i][j++] = color;
		}

		++i;
	}
}

int sx, sy;
int gx, gy;
int n;

#define X first
#define Y second

void func(char map[100 + 2][100 + 2])
{
	int mx[] = { 0 ,1 ,-1 ,0 };
	int my[] = { 1 ,0 ,0 ,-1 };
	int way = map[sy][sx];
	queue< pair< int, int > > que;
	que.push(make_pair(sx, sy));

	while (!que.empty())
	{
		pair<int, int> top = que.front(); que.pop();

		int x = top.X, y = top.Y;
		if (map[y][x] == way)
		{
			if (x == gx && y == gy)
			{
				puts("OK");
				return;
			}

			map[y][x] = none;

			int i = 4;
			while (i--)
			{
				int xx = x + mx[i];
				int yy = y + my[i];

				if (map[yy][xx] == way)
				{
					que.push(make_pair(xx, yy));
				}
			}
		}
	}

	puts("NG");
}

int main(void)
{
	char map[100 + 2][100 + 2];
	int W, H;
	while (1)
	{
		scanf("%d %d", &W, &H);

		if ((W | H) == 0)
		{
			return 0;
		}

		scanf("%d %d", &sx, &sy);
		scanf("%d %d", &gx, &gy);
		scanf("%d", &n);

		int i;
		for (i = 0; i < n; ++i)
		{
			int color, d, x, y;
			scanf("%d %d %d %d", &color, &d, &x, &y);

			if (d == wide)
			{
				WideBlock(map, color, x, y);
			}

			if (d == high)
			{
				HighBlock(map, color, x, y);
			}
		}

		func(map);
	}
}


Measured memory_bytes: 3044
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

template<typename T>
void debug(T arr) {
	for(auto it : arr) {
		cout << it << '\n';
	}
}

int main()
{
	io
	#ifdef CODE
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	ll n, x, y;
	cin >> n >> x >> y;
	vector<vi> edges(n);
	fr(i, 0, n - 1) {
		edges[i].push_back(i + 1);
		edges[i + 1].push_back(i);
	}
	x--, y--;
	edges[x].push_back(y);
	edges[y].push_back(x);
	vector<vl> dist(n, vl(n));
	auto djikstra = [&] (ll s) {
		set< pair<ll, ll> > setds;
	    vector<ll> dis(n, INT_MAX);
	    setds.insert(make_pair(0, s)); 
	    dis[s] = 0; 
	    while (!setds.empty()) 
	    {
	        pair<int, int> tmp = *(setds.begin()); 
	        setds.erase(setds.begin());  
	        int u = tmp.second;
	        for (auto i = edges[u].begin(); i != edges[u].end(); ++i) 
	        {
	            int v = (*i); 
	            int weight = 1; 
	            if (dis[v] > dis[u] + weight) 
	            { 
	                if (dis[v] != INT_MAX) 
	                    setds.erase(setds.find(make_pair(dis[v], v))); 
	 	                dis[v] = dis[u] + weight; 
	                setds.insert(make_pair(dis[v], v)); 
	            } 
	        } 
	    } 
	    return dis;
	};
	vl ans(n - 1);
	fr(i, 0, n) {
		dist[i] = djikstra(i);
	}
	fr(i, 0, n) {
		fr(j, i + 1, n) {
			ans[dist[i][j] - 1]++;
		}
	}
	debug(ans);

	#ifdef CODE
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	return 0;
}

Measured memory_bytes: 31744
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1LL<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1LL<<(i))))
#define setbit1(n,i) ((n)|(1LL<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define DBG(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define EN cout<<"\n"
#define fi first
#define se second
#define PI (acos(-1))
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 200005
template<class T> ostream& operator<<(ostream &s,pair<T,ll> a)
{
    s<<a.fi<<' '<<a.se;
    return s;
}
char grid[1005][1005];
int main()
{
    fastread;
    ll T=1;
//    cin>>T;
    for(ll qq=1;qq<=T; qq++)
    {
        ll n,m,a,b;
        cin>>n>>m>>a>>b;
        for(int i=0;i<n;i++)
        {
            if((n-i)%2)
            {
                for(int j=0;j<min(m/2,a);j++)
                {
                    grid[i][2*j]='<';
                    grid[i][2*j+1]='>';
                }
                a-=min(m/2,a);
                if(a==0)break;
            }
            else
            {
                ll x=m/2;
                for(int j=0;j<min(x*2,a);j++)
                {
                    if(m%2&&n%2&&(a-j)==1&&j%2==0)
                    {
                        grid[n-1][m-2]='<';
                        grid[n-1][m-1]='>';
                        continue;
                    }
                    grid[i+j%2][j/2*2]='<';
                    grid[i+j%2][j/2*2+1]='>';
                }
                a-=min(x*2,a);
                i++;
                if(a==0)break;
            }
        }
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(grid[i][j]==0&&i!=n-1&&grid[i+1][j]==0&&b)
                {
                    grid[i][j]='^';
                    grid[i+1][j]='v';
                    b--;
                }
                else if(grid[i][j]==0)grid[i][j]='.';
            }
            grid[i][m]='\0';
        }
//        cout<<a<<' '<<b<<endl;
        if(a||b)cout<<"NO"<<endl;
        else
        {
            cout<<"YES"<<endl;
            for(int i=0;i<n;i++)
                cout<<grid[i]<<endl;
        }
    }
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
signed main(){
	int n,k;
	string s;
	cin>>n>>k>>s;
	int cnt=0;
	vector<P> vec;
	int st=0,en=0,whnum=0;
	rep(i,n){
		if(!i||s[i]==s[i-1])cnt++;
		else{
			vec.push_back({cnt,s[i-1]-'0'});
			if(s[i-1]=='0')whnum++;
			cnt=1;
		}
	}
	vec.push_back({cnt,s.back()-'0'});
	if(s.back()=='0')whnum++;
	if(whnum<=k){
		cout<<n<<endl;
		ggr;
	}
	int l=0,r=0,ans=0,sum=0,now=0;
	cnt=0;
	while(cnt<=k){
		sum+=vec[now].first;
		if(vec[now].second==0){
			if(cnt==k){
				sum-=vec[now].first;
				break;
			}
			cnt++;
		}
		now++;
	}
	ans=max(ans,sum);
	r=now-1;
	rep(i,whnum-k){
		while(vec[l].second!=0){
			sum-=vec[l].first;
			l++;
		}
		sum-=vec[l].first;
		l++;
		r++;
		sum+=vec[r].first;
		while(vec[r+1].second!=0){
			r++;
			sum+=vec[r].first;
			if(r==vec.size()-1)break;
		}
		ans=max(ans,sum);
	}
	cout<<ans<<endl;
	ggr;
}

Measured memory_bytes: 2548
N = int(input())

D1 = []
D2 = []

for i in range(N):
  s = input().split()
  D1.append(int(s[0]))
  D2.append(int(s[1]))
  
result = 'No'  
  
for i in range(N-2):
  if D1[i] == D2[i]:
    if D1[i+1] == D2[i+1] and D1[i+2] == D2[i+2]:
      result = 'Yes'
      
print(result)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;


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

Measured memory_bytes: 3588
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < n;i++)
int w, h;
int map[50][50];
int dx[8] = { -1,0,1,-1,1,-1,0,1 }, dy[8] = { -1,-1,-1,0,0,1,1,1 };
void dfs(int y, int x) {
	map[y][x] = 0;
	for (int i = 0; i < 8;i++) {
		int nx = x + dx[i];
		int ny = y + dy[i];
		if (nx < 0 || ny >= h || ny < 0 || nx >= w) continue; 
		if(map[ny][nx] == 1) {
			dfs(ny, nx);
		}
	}
}
void dfss() {
	int count = 0;
	rep(i, h) {
		rep(j, w) {
			if (map[i][j] == 1) {
				count++; 
				dfs(i, j);
			}
		}
	}
	cout << count << endl;
}
int main() {
	for (;;) {
		cin >> w >> h;
		if (w == 0 && h == 0)
			break;
		rep(i, h) {
			rep(j, w) {
				cin >> map[i][j];
			}
		}
		dfss();
	}
}


Measured memory_bytes: 3120
#define max(a,b) ((a)>(b)?(a):(b))
int p[9999];

solve(int n,int m,int c){
  int i,j,k;
  double d=0;
  for(i=0;i<m;i++)p[i]=1;
  for(i=1;i<n;i++)
    for(j=(i+1)*(m-1);~j;j--)
      for(k=j-1;k>=max(0,j-(m-1));k--)
        p[j]+=p[k];
  for(i=0;i<=n*(m-1);i++)
    d+=p[i]*(i+n>c?i+n-c:1);
  for(i=0;i<n;i++)d/=m;
  printf("%.8lf\n",d);
}

main(){
  int n,m,k;
  while(scanf("%d%d%d",&n,&m,&k),n){
    memset(p,0,sizeof(p));
    solve(n,m,k);
  }
exit(0);}

Measured memory_bytes: 672
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int q = scanner.nextInt();
    for (int i = 0; i < q; i++) {
      long a = scanner.nextLong();
      long b = scanner.nextLong();
      System.out.println(solve(a, b));
    }
  }

  private static long solve(long a, long b) {
    if (a > b) return solve(b, a);

    if (a == b) return 2 * a - 2;
    if (a + 1 == b) return 2 * a - 2;

    long ab = Math.multiplyExact(a, b);
    long c = findUpperRoot(ab);
    long cc1 = Math.multiplyExact(c, c + 1);
    if (cc1 >= ab) return 2 * c - 2;
    return 2 * c - 1;
  }

  private static long findUpperRoot(long n) {
    long ll = 0;
    long ul = (long) Math.sqrt(n) + 1;
    while (Math.addExact(ll, 1) < ul) {
      long mid = Math.addExact(ll, ul) / 2;
      if (Math.multiplyExact(mid, mid) < n) {
        ll = mid;
      } else {
        ul = mid;
      }
    }
    return ll;
  }
}


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

int main(){
	int h1,m1,n1,h2,m2,n2;
	int h,m,n;
	
	for( int i = 0; i < 3; i++ ){
		cin >> h1 >> m1 >> n1 >> h2 >> m2 >> n2;
		h = h2-h1;
		m = m2-m1;
		if( m < 0 ){
			h--;
			m+=60;
		}
		n = n2-n1;
		if( n < 0 ){
			m--;
			n += 60;
		}
		if( m < 0 ){
			h--;
			m+=60;
		}
		cout << h << " " << m << " " << n << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
a, b, c, d= map(int, input().split())
abcd = [1] * 4
abcd[0] = a * c
abcd[1] = a * d
abcd[2] = b * c
abcd[3] = b * d

fmax = abcd[0]
for i in abcd:
    if i > fmax:
        fmax = i
print(fmax)


Measured memory_bytes: 9180
import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine
  val ans = StdIn.readLine.split(" ").map(_.toInt)
    .toVector
    .sorted(Ordering[Int].reverse)
    .zipWithIndex
    .foldLeft(0){ (acc,e) =>
      acc + ( if((e._2 & 1) == 0) e._1 else -e._1 )
    }

  println(ans)
}


Measured memory_bytes: 27448
<?php
while($line=fgets(STDIN)){
    $line = rtrim($line);
    $data = explode(" ", $line);
    if ($data[0] < $data[1]) {
        echo "a < b" . PHP_EOL;
    } elseif ($data[0] == $data[1]) {
        echo "a == b" . PHP_EOL;
    } else {
        echo "a > b" . PHP_EOL;
    }
}

Measured memory_bytes: 15224
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd_list([i, j, k])

print(ans)

Measured memory_bytes: 69436
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main(){

	vector<int> hills(10);

	for (auto& a : hills) {
		cin >> a;
	}

	sort(hills.begin(), hills.end(), greater<int>());

	for (int i = 0; i < 3; i++)
	{
		cout << hills[i] << endl;
	}
	
	return 0;
}

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

int main () {
	string s;
	int cnt = 0;
	cin >> s;
	for (int i = 0; i < s.length(); i++){
        if (i % 2 == 0){
            if (s[i] == 'p'){
                cnt--;
            }
        }
        else{
            if (s[i] == 'g'){
                cnt++;
            }
        }
	}
	cout << cnt;
}


Measured memory_bytes: 512
N = int(input())

T, A = map(int, input().split())

for i in range(N-1):
  t, a = map(int, input().split())
  da = (a - A%a)%a
  dt = (A + da)*t//a - T
  if dt >= 0:
    A += da
    T += dt
  else:
    i = -(dt // t)
    da += i*a
    dt += i*t
    A += da
    T += dt

print(T + A)

Measured memory_bytes: 3064
//https://atcoder.jp/contests/abc144/tasks/abc144_c
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-3.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;
    ll rt=sqrt(N);    
    ll ans=INT64_MAX;
    FOR(i,1,rt+2){
        if(N%i==0){
            ll a=i;
            ll b=N/a;
            ans=min(a-1+b-1,ans);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main() {
  int h[1501], w[1501];

  int N, M;
  while (cin >> N >> M, (N || M)) {
    for (int i=0; i<N; i++) {
      int t; cin >> t; h[i] = t;
    }
    for (int i=0; i<M; i++) {
      int t; cin >> t; w[i] = t;
    }

    vector<int> V(1500001), H(1500001);
    for (int i=0; i<N; i++) {
      int len = 0;
      for (int j=i; j<N; j++) {
        len += h[j];
        V[len]++;
      }
    }
    for (int i=0; i<M; i++) {
      int len = 0;
      for (int j=i; j<M; j++) {
        len += w[j];
        H[len]++;
      }
    }

    int count = 0;
    for (int i=1; i<=1500000; i++) {
      count += V[i] * H[i];
    }
    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 12872
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <boost/math/common_factor_rt.hpp>
#define EPS (1e-7)
using namespace std;
#define ll long long


int main() {

	int A, B, C;

	cin >> A >> B >> C;

	int ans = C - (A - B);

	if (ans < 0)ans = 0;


	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
/** Author: Dwai
 *  Omae wa mou shindeiru!
**/

#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define fr(i,a,b) for (i = a; i <= b; i++)
#define frr(i,a,b) for (i = a; i >= b; i--)
#define rep(i,n) for (i = 0 ; i < n; i++)
#define repr(i,n) for (i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define flushinput   cin.ignore(numeric_limits<streamsize>::max(),'\n');

void debug_out() { cerr << endl; }

void clock_out(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}

void fileio(){
  freopen("/home/dwai/Desktop/cp/input.txt","r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}

void ofileio(){
  freopen("input.txt","r", stdin);
  freopen("output.txt", "w", stdout); 
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define fio() fileio()
#define ofio() fileio()
#define clock() clock_out()
#else
#define debug(...) 42
#define fio() 42
#define ofio() ofileio()
#define clock() 42
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef map<ll,ll> mll;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

vector<long long> prime;
bool is_composite[1000001];

void linear_sieve(long long n)
{
	fill(is_composite, is_composite+n, false);
	is_composite[0]=is_composite[1]=true;
	for(long long i=2;i<n;i++)
	{
		if(!is_composite[i]) prime.emplace_back(i);
		for(long long j=0;j<prime.size() && i*prime[j]<n;++j)
		{
			is_composite[i*prime[j]]=true;
			if(i%prime[j]==0) break;
		}
	}
}

void solve()
{
	linear_sieve(100100);
	ll x;cin>>x;
	cout<<*lower_bound(all(prime),x);
}

int main()
{
//	fio();
	fast
	ll t=1;
	//cin>>t;

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

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

int a[45];

int f(int n){
  if(n == 0 || n ==1){
    a[n] = 1;
    return 1;
  }
  else if(a[n]!=-1){
    return a[n];
  }
  else {
    a[n] = f(n-1) + f(n-2);
    return f(n-1) + f(n-2);
  }
}

int main(){
  int n,i;
  for ( i = 0;i<50;i++){
    a[i] = -1;
  }
  scanf("%d",&n);
  printf("%d\n",f(n));

  return 0;
}

Measured memory_bytes: 596
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		String str = stdIn.next();
		int size = str.length();
		int count = 0;
		if(size % 2 == 0)
		{
			if(str.charAt(size / 2 - 1) == 'i' && str.charAt(size / 2) == 'i' || 
			   str.charAt(size / 2 - 1) == 'w' && str.charAt(size / 2) == 'w' ||
			   str.charAt(size / 2 - 1) == '(' && str.charAt(size / 2) == ')' ||
			   str.charAt(size / 2 - 1) == ')' && str.charAt(size / 2) == '(')
			{
				;
			}
			else
			{
				++count;
			}
			for(int i = 0; i < size / 2 - 1; ++i)
			{
				if(str.charAt(i) == 'i' && str.charAt(size -i - 1) == 'i' ||
				   str.charAt(i) == 'w' && str.charAt(size -i - 1) == 'w' ||
				   str.charAt(i) == '(' && str.charAt(size -i - 1) == ')' ||
				   str.charAt(i) == ')' && str.charAt(size -i - 1) == '(')
				{
					;
				}
				else
				{
					++count;
				}
			}
		}
		else
		{
			if(str.charAt(size / 2) == 'i' || str.charAt(size / 2) == 'w')
			{
				;
			}
			else
			{
				++count;
			}
			for(int i = 0; i < size / 2; ++i)
			{
				if(str.charAt(i) == 'i' && str.charAt(size -i - 1) == 'i' ||
				   str.charAt(i) == 'w' && str.charAt(size -i - 1) == 'w' ||
				   str.charAt(i) == '(' && str.charAt(size -i - 1) == ')' ||
				   str.charAt(i) == ')' && str.charAt(size -i - 1) == '(')
				{
					;
				}
				else
				{
					++count;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 17140
# coding: utf-8

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = [[a, i + 1] for i, a in enumerate(A)]
    B.sort()
    for i, j in B:
        if i == N:
            print(j)
        else:
            print(j, "", end='')


if __name__ == "__main__":
    main()


Measured memory_bytes: 25104
#include <algorithm>
#include <cctype>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

int main(void) {
    int w, a, b;
    cin >> w >> a >> b;

    if ((a <= b && b <= a + w) || (a <= b + w && b + w <= a + w)) {
        cout << 0 << endl;
        return 0;
    }

    int ans = 1e9;
    ans = min(ans, abs(a - b));
    ans = min(ans, abs((a + w) - b));
    ans = min(ans, abs(a - (b + w)));
    ans = min(ans, abs((a + w) - (b + w)));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n=gets.to_i
as=gets.split.map(&:to_i).sort
bs=[]
if n.even?
  1.step(n-1,2){|i| bs.push(i,i)}
else
  bs.push(0)
  2.step(n,2){|i| bs.push(i,i)}
end
puts as==bs ? (2**(n/2))%(10**9+7):0


Measured memory_bytes: 10480