akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

struct TNode
{
	int Index;
	TNode* Parent;
	TNode* Left;
	TNode* Right;
	
	TNode();
};

TNode::TNode()
{
	Index  = -1;
	Parent = NULL;
	Left   = NULL;
	Right  = NULL;
}

typedef std::vector<TNode> TBinaryTree;

void InputNode(TBinaryTree& Tree)
{
	int Index;
	std::cin >> Index;
	Tree[Index].Index = Index;
	
	int Left;
	std::cin >> Left;
	if(Left >= 0){
		Tree[Index].Left  = &(Tree[Left]);
		Tree[Left].Parent = &(Tree[Index]);
	}
	
	int Right;
	std::cin >> Right;
	if(Right >= 0){
		Tree[Index].Right  = &(Tree[Right]);
		Tree[Right].Parent = &(Tree[Index]);
	}
}

const TNode* GetRoot(const TBinaryTree& Tree)
{
	const TNode* Node = &(Tree[0]);
	while(Node->Parent){
		Node = Node->Parent;
	}
	return Node;
}

const TNode* GetRightEnd(const TBinaryTree& Tree)
{
	const TNode* Node = GetRoot(Tree);
	while(Node->Right){
		Node = Node->Right;
	}
	return Node;
}

void OutputPreOrder(const TNode* Root, const TNode* End)
{
	if(Root == NULL) return;
	std::cout << " " << Root->Index;
	OutputPreOrder(Root->Left, End);
	OutputPreOrder(Root->Right, End);
}

void OutputInorder(const TNode* Root, const TNode* End)
{
	if(Root == NULL) return;
	OutputInorder(Root->Left, End);
	std::cout << " " << Root->Index;
	OutputInorder(Root->Right, End);
}

void OutputPostOrder(const TNode* Root, const TNode* End)
{
	if(Root == NULL) return;
	OutputPostOrder(Root->Left, End);
	OutputPostOrder(Root->Right, End);
	std::cout << " " << Root->Index;
}

void OutputWalkOrders(const TBinaryTree& Tree)
{
	std::cout << "Preorder" << std::endl;
	OutputPreOrder(GetRoot(Tree), GetRightEnd(Tree));
	std::cout << std::endl;
	std::cout << "Inorder" << std::endl;
	OutputInorder(GetRoot(Tree), GetRightEnd(Tree));
	std::cout << std::endl;
	std::cout << "Postorder" << std::endl;
	OutputPostOrder(GetRoot(Tree), GetRoot(Tree));
	std::cout << std::endl;
}

int main()
{
	int Count;
	std::cin >> Count;
	TBinaryTree BinaryTree(Count);
	for(int i = 0; i < Count; i++){
		InputNode(BinaryTree);
	}
	OutputWalkOrders(BinaryTree);
	return 0;
}

Measured memory_bytes: 3120
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef double dd;
typedef pair <int, int> pii;
#define pb push_back
#define pf push_front
#define f first
#define s second
#define sz(x) (int)x.size()
#define smin(x , y) x = min(x , y)
#define smax(x , y) x = max(x , y)
#define mp make_pair
int32_t main(){		
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	cout.tie(0);
	int a, b, k;
	cin >> a >> b >> k;
	if(k > a)
		cout << 0 << " " << max((ll)0 , b - (k - a)) << endl;
	else
		cout << a - k << " " << b << endl;
	return 0;
}



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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename Ostream,typename Container>
Ostream& operator<<(Ostream& os,const Container& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

int main()
{
	for(array<string,3> ss;cin>>ss[0]>>ss[1]>>ss[2];){
		int n=ss[0].size();
		rep(i,3) reverse(all(ss[i]));
		
		vvi dp(2,vi(n+1)); dp[0][0]=1;
		rep(i,n){
			vvi cs(3);
			rep(j,3){
				if(ss[j][i]=='?')
					cs[j]=i==n-1?vi{1,2,3,4,5,6,7,8,9}:vi{0,1,2,3,4,5,6,7,8,9};
				else
					cs[j].push_back(ss[j][i]-'0');
			}
			rep(carry,2){
				for(int c0:cs[0]) for(int c1:cs[1]) for(int c2:cs[2]){
					if(carry+c0+c1==c2)
						(dp[0][i+1]+=dp[carry][i])%=MOD;
					if(carry+c0+c1==10+c2)
						(dp[1][i+1]+=dp[carry][i])%=MOD;
				}
			}
		}
		cout<<dp[0][n]<<endl;
	}
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
string s;
int N;
int main(){
	cin >> s;
	N = s.size();
	if(s[N-1]=='1'){
		cout << -1 << endl;
		return 0;
	}
	if(s[0]=='0'){
		cout << -1 << endl;
		return 0;
	}
	for(int i=0;i<N-1;i++){
		if(s[i]!=s[N-2-i]){
			cout << -1 << endl;
			return 0;
		}
	}
	int l = N;
	for(int i=N-1;i>=1;i--){
		cout << i << ' ' << l << endl;
		if(s[i-1]=='1')l=i;
	}
	return 0;
}

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

int main(void) {
    int a,b;
    cin>>a>>b;
    string A = "";
    string B = "";
    for (int i = 1; i <= b; i++) A += to_string(a);
    for (int i = 1; i <= a; i++) B += to_string(b);
    if (a < b) cout << A << endl;
    else if (b < a) cout << B << endl;
    else cout << A << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long

using namespace std;

int main() {
  int n;
  scanf("%d", &n);

  string s;
  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    s[i] = 65 + (s[i] + n - 65) % 26;
  }
  cout << s << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

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

        // input
        long height = scan.nextLong();
        long width = scan.nextLong();

        // answer
        if(height == 1 && width > 1){
            System.out.println(width - 2);
        } else if (width == 1 && height > 1){
            System.out.println(height - 2);
        } else if(height == 1 && width == 1){
            System.out.println(1);
        } else {
            System.out.println((height - 2) * (width - 2));
        }


    }
}

Measured memory_bytes: 21844
main = do n <- readLn
          let ns = [1..n]
          putStrLn . (" " ++) . unwords . map show $ filter solve ns

solve :: Int -> Bool
solve n | n `mod` 3 == 0 = True
        | n `mod` 10 == 3 = True
        | (n `div` 10) `mod` 10 == 3 = True
        | (n `div` 100) `mod` 10 == 3 = True
        | (n `div` 1000) `mod` 10 == 3 = True
        | otherwise = False

Measured memory_bytes: 4152
#include <stdio.h>

int gcd(int , int);
int main()
{
  int a,b,c;

  scanf("%d%d",&a,&b);
 
  c=gcd(a,b);
  printf("%d\n",c);


  return 0;

}

gcd(int a,int b){
  int r;

  while(b>0){
    r=a%b;
  a=b;
b=r;
}


  return a;

}

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


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

	int A,B;
	cin >> A >> B;

	if (A-(B*2)>=1) {
		cout << A-(B*2) << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 3596
#include<iostream>
#include<math.h>
//#inclde<map>                                                                                                         
using namespace std;

int main()
{
  // 入力                                                                                                              
  int A, B;
  cin >> A >> B;

  int ans;
  ans = max(max((2*A-1), (2*B-1)), (A+B));

  //出力                                                                                                               
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a <= c && b >= c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	
 	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)














int main(){
    ll h, w;
    cin >> h >> w;
    cout << ((h == 1 || w == 1)? 1 : (h * w + 1) / 2) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
   int n;
   cin>>n;
   vector<int> v1(n),v2(n),v3(n);
   int i=0;
   while(i<n){
       cin>>v1[i]>>v2[i]>>v3[i];
       i++;
   }
   int dp[n][3];
   dp[0][0]=v1[0];
   dp[0][1]=v2[0];
   dp[0][2]=v3[0];

   for(int i=1;i<n;i++){
        dp[i][0]=v1[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=v2[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=v3[i]+max(dp[i-1][1],dp[i-1][0]);
   }
   cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
   return 0;
}

Measured memory_bytes: 5580
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <set>
#include <bitset>
using namespace std;

int main(void){
    long long int a, b = 0;
    string sb;
    int cnt = 0;
    cin >> a >> sb;
    if(a == 0){
        cout << 0 << endl;
        return 0;
    }
    long long int s = sb.size();
    for(int i = 0; i < s; i++){
        if(sb[i] >= '0' && sb[i] <= '9'){
            b = b*10 + sb[i] - '0';
            cnt += 1;
        }
        if(cnt == 3) break;
    }
    if(cnt != 3){
        for(int i = cnt; i <= 3; i++){
            b = b*10;
        }
    }
    //cout << b << endl;
    long long int ans = a*b;
    string ans_s = to_string(ans);
    s = ans_s.size();
    if(s < 3){
        cout << 0 << endl;
        return 0;
    }
    for(int i=0; i < s - 2; i ++){
        cout << ans_s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3668
import sys
import numpy as np

def parse(inp):
    road=np.array([],dtype=int)
    for i in range(3):
        road=np.append(road,np.array([list(next(inp).split())],dtype=int))
    return road
  
def main(inp):
    road=parse(inp)
    count=[0,0,0,0]
    for i in range(len(road)):
        count[road[i]-1]+=1
        if(count[road[i]-1]==3):
            return """NO
"""
            break
            
    return """YES
"""

print(main(sys.stdin))

Measured memory_bytes: 15644
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define LL long long
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define fd(i,j,k) for(int i=j;i>=k;i--)
#define fr(i,j) for(int i=beg[j];i;i=nex[i])
using namespace std;
int const mn=1e5+3,mo=1e9+7;
int n,m,a[mn],ans[3][3],mat[3][3],tmp[3][3];
void doub(){
	memset(tmp,0,sizeof(tmp));
	fo(i,0,2)fo(j,0,2)fo(k,0,2)
		tmp[i][k]=(tmp[i][k]+1ll*mat[i][j]*mat[j][k])%mo;
	fo(i,0,2)fo(j,0,2)mat[i][j]=tmp[i][j];
}
void mult(){
	memset(tmp,0,sizeof(tmp));
	fo(i,0,2)fo(j,0,2)fo(k,0,2)
		tmp[i][k]=(tmp[i][k]+1ll*ans[i][j]*mat[j][k])%mo;
	fo(i,0,2)fo(j,0,2)ans[i][j]=tmp[i][j];
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,1,m)scanf("%d",&a[i]);
	a[++m]=n;
	fd(i,m,2)a[i]-=a[i-1];
	ans[0][1]=2;ans[0][0]=ans[0][2]=1;
	fo(i,1,m){
		int tm2=a[i]-1;
		memset(mat,0,sizeof(mat));
		mat[0][0]=mat[1][1]=1;mat[2][2]=2;
		mat[0][1]=2;mat[0][2]=mat[1][2]=1;
		mat[2][1]=2;mat[2][0]=1;
		for(;tm2;tm2/=2,doub())if(tm2&1)mult();
		memset(mat,0,sizeof(mat));
		mat[0][0]=mat[1][1]=mat[2][2]=1;
		mat[0][1]=2;mat[0][2]=mat[1][2]=1;
		if(i!=m)mult();
	}
	printf("%d",ans[0][2]);
	return 0;
}


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

int main() {
  int N, Y;
  cin >> N >> Y;
  bool arieru = false;
  for (int yukichi = 0; yukichi <= N; yukichi++) {
    for (int ichiyo = 0; ichiyo <= N; ichiyo++) {
      int hideyo = N - yukichi - ichiyo;
      int otoshidama = 10000 * yukichi + 5000 * ichiyo + 1000 * hideyo;
      if (hideyo >= 0 && otoshidama == Y) {
        cout << yukichi << " " << ichiyo << " " << hideyo << endl;
        arieru = true;
        break;
      }
    }
    if (arieru) break;
  }
  if (!arieru)
    cout << "-1 -1 -1" << endl;
}



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

using namespace std;

const int N = 1e6+100;

long long int a[N], a2[N];

long long int laz[N];

int main () {
  	ios::sync_with_stdio(0);
	long long int n, k;
	cin >> n >> k;
	for(int i = 0 ; i < n ; i++ ) {
		cin >> a[i];
	}
	while(k--) {
		for(int i = 0 ; i <= n ; i++) laz[i] =0 ;
		for(int i = 0 ; i < n ;i++ ) {
			laz[max(0ll,i-a[i])]++;
			laz[min(n-1, i+a[i])+1]--;
		}
		a2[0] = laz[0];
		for(int i = 1 ; i < n ; i ++ ) {
			a2[i]=a2[i-1]+laz[i];
		}
		bool br = 1;
		for(int i = 0 ; i < n ; i++ ) {
			if(a[i]!=a2[i]) br=0;
			a[i]=a2[i];
		}
		if(br)break;
	}
	for(int i = 0 ; i < n ; i++ ) cout << a[i] << ' ';
}


Measured memory_bytes: 8288
import sys
def q(a,h):
 d[a]=h
 for b in t[a]:q(b,h+1)
t,p,d={},{},{}
n=int(input())
for e in sys.stdin:
 e=e.split()
 t[e[0]]=e[2:]
 for i in e[2:]:p[i]=e[0]
r=(set(t)-set(p)).pop()
p[r]='-1'
q(r,0)
print('\n'.join(f"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '.join(t[i])}]"for i in map(str,range(n))))


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

int main(){
    int D,T,S;
    cin >> D >> T >> S;
    if(D/S + (D%S!=0)<=T){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h> 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vv = vector<vector<int>>;
using P = pair<int,int>;

int func( int n ){
  if( n%2 != 0 || n == 0 ) return 0;
  return 1 + func(n/2);
}

int main(){
  int n;
  cin >> n;
  int sum=0;
  rep(i,n){
    int num;
    cin >> num;
    sum += func(num);
  }
  cout << sum << endl;
  return 0;
}


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

int main(){
  int a, b;
  
  cin >> a >> b;
  
  if(a == 2 || b == 2){
    cout << "No" << endl;
  } else {
	if(a == 4 || a == 6 || a == 9 || a == 11){
      if(b == 4 || b == 6 || b == 9 || b == 11){
			cout << "Yes" << endl;
      } else {
        cout << "No" <<endl;
      }
    } else {
      if(b != 4 || b != 6 || b != 9 || b != 11){
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>

int main() {
  int q;
  std::cin >> q;
  while (q-- > 0) {
    int64_t A, B;
    std::cin >> A >> B;
    int64_t N = A * B;

    int64_t mid = std::sqrt(static_cast<long double>(N - 1));
    int64_t ans = mid * 2;
    if (A != B)
      ans--;
    if (mid * (mid + 1) >= N)
      ans--;
    std::cout << ans << std::endl;
  }
}


Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, long long k, long long r, long long s, long long p, std::string t){
    vector<vector<pair<int,int>>> val_list(k);
    for(int i = 0; i < n; ++i){
        int val = r;
        int fl = 0;
        if(t[i] == 'r'){
            val = p;
            fl = 1;
        }
        if(t[i] == 'p'){
            val = s;
            fl = 2;
        }
        val_list[i % k].emplace_back(val, fl);
    }
    i64 sum = 0;
    for(int i = 0; i < k; ++i){
        array<i64, 3> dp{0, 0, 0};
        for(auto& x : val_list[i]){
            array<i64, 3> nex{0, 0, 0};
            for(int j = 0; j < 3; ++j){
                for(int k = 0; k < 3; ++k){
                    if(j == k)
                        continue;
                    chmax(nex[k], dp[j] + (k == x.second ? x.first : 0));
                }
            }
            dp = move(nex);
        }
        sum += max({dp[0], dp[1], dp[2]});
    }
    cout << sum << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long R;
    scanf("%lld",&R);
    long long S;
    scanf("%lld",&S);
    long long P;
    scanf("%lld",&P);
    std::string T;
    std::cin >> T;
    solve(N, K, R, S, P, T);
    return 0;
}


Measured memory_bytes: 5248
#include <cstdio>

int main() {
	int L, M, N;
	while (scanf("%d", &L)) {
		if (L == 0) break;
		int res = 0;
		bool flag = true;
		for (int i=0; i<12; i++) {
			scanf("%d%d", &M, &N);
			L -= (M - N);
			if (flag) {
				res++;
			}
			if (L <= 0) flag = false;
		}
		if (res == 12 && L > 0) {
			printf("NA\n");
		} else {
			printf("%d\n", res);
		}
	}
}

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

int main() {
  string s;
  cin >> s;
  if(s.at(0) == s.at(1) && s.at(1) == s.at(2)) {
    cout << "No" <<endl;
  }
  else if(s.at(0) == s.at(1) && s.at(2) == s.at(3)) {
    cout << "Yes" <<endl;
  }
  else if(s.at(0) == s.at(2) && s.at(1) == s.at(3)) {
    cout << "Yes" <<endl;
  }
  else if(s.at(0) == s.at(3) && s.at(2) == s.at(1)) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define d(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
#define ri register int
#define ll long long
#define il inline
int max(int x, int y) {return x>y?x:y;} ll min(ll x, ll y) {return x<y?x:y;}
ll n, k;
int main(){
  cin>>n>>k;
  n%=k; cout<<min(n, k-n)<<endl;
  return 0;
}
// sto wyxkk orz

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<cmath>
#include<vector>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define eps 1e-8
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) (a<b?a:b)
#define ll long long
#define INF 9223372036854775807
int prime[1000005];
bool isprime[10000005];
int num;
int main()
{
    for(int i=2;i<1000005;i++)
    {
        if(isprime[i])
            continue;
        prime[num++]=i;
        for(int j=2*i;j<1000005;j+=i)
        {
            isprime[j]=1;
        }
//        if(i<100)
//            printf("%d\n",prime[num-1]);
    }
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int ans=upper_bound(prime,prime+num,n)-prime;
        printf("%d\n",ans);
    }
    return 0;
}

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

int main(){
  int A,B,C,D,L,R;
  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{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());
    String m = sc.nextLine();
    String[] mm = m.split(" ");
    int[] o = new int[n];
    for (int i = 0; i < n; i++) {
      o[i] = Integer.parseInt(mm[i]);
    }
    Arrays.sort(o);
    System.out.println(o[n - 1] - o[0]);
  }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define p pair<int,int>
#define P pair<int,p>
using namespace std;

vector<p>rinsetu[100];
vector<int>k[100];
int mincost[100][2];//0 ?????£????????? 1 ?????£??? 
void saiki(int a,int b,int c){//start now ?????°
    if(c==2){
	k[a].push_back(b);
	}
    else{
	for(p i:rinsetu[b]){
	    saiki(a,i.second,c+1);
	    }
	}
    }
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
	for(int c=0;c<a;c++){
	    mincost[c][0]=mincost[c][1]=1<<29;
	    rinsetu[c].clear();k[c].clear();
	    }
	for(int c=0;c<b;c++){
	    int d,e,f;scanf("%d%d%d",&d,&e,&f);d--;e--;
	    rinsetu[d].push_back(p(f,e));
	    rinsetu[e].push_back(p(f,d));
	    }
      for(int c=0;c<a;c++)saiki(c,c,0);
      mincost[0][0]=0;
      priority_queue<P,vector<P>,greater<P>>Q;
      Q.push(P(0,p(0,0)));
      while(Q.size()){
	  P t=Q.top();Q.pop();
	  for(p i:rinsetu[t.second.first]){
	      if(mincost[i.second][t.second.second]>t.first+i.first){
		  mincost[i.second][t.second.second]=t.first+i.first;
		  Q.push(P(t.first+i.first,p(i.second,t.second.second)));
		  }
	      }
	      if(t.second.second==0){
		  for(int i:k[t.second.first]){
		      if(mincost[i][1]>t.first){
			  mincost[i][1]=t.first;
			  Q.push(P(t.first,p(i,1)));
			  }
		      }
		  }}
	  cout<<min(mincost[a-1][0],mincost[a-1][1])<<endl;
	  }
    }

Measured memory_bytes: 3192
#include <iostream>
using namespace std;
int main(void){
  int a,b,c;
    cin>>a>>b>>c;
    if(a==b){
        cout<<c<<endl;
    }
    else if(a==c){
        cout<<b<<endl;
    }
    else{
        cout<<a<<endl;
        
    }
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  int ans = max({A+B,A-B,A*B});
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

vector<string> split(string str, char d) {
  istringstream s(str);
  string in;
  vector<string> val;
  while (getline(s,in,d)) val.push_back(in);
  return val;
}

using VS = vector<string>;

tuple<VS, VS>
string_partition(string const &prog) {
  auto const splits = split(prog, '"');
  vector<string> cmds, strs;
  for (int i = 0, len = (int)splits.size(); i < len; ++i) {
    (i % 2 == 0 ? cmds : strs).push_back(splits[i]);
  }
  return make_tuple(cmds, strs);
}

bool close(tuple<VS,VS> const &v1, tuple<VS,VS> const &v2) {
  VS c1, s1, c2, s2;
  tie(c1, s1) = v1, tie(c2, s2) = v2;
  if (c1 != c2 || s1.size() != s2.size()) {
    return false;
  }
  int differs = 0;
  for (int i = 0, len = (int)s1.size(); i < len; ++i) {
    if (s1[i] != s2[i]) {
      ++differs;
    }
  }
  return differs < 2;
}

void solve(string const &s1, string const &s2) {
  if (s1 == s2) {
    cout << "IDENTICAL" << endl;
    return;
  }
  auto const v1 = string_partition(s1);
  auto const v2 = string_partition(s2);
  cout << (close(v1, v2) ? "CLOSE" : "DIFFERENT") << endl;
}

int main() {
  // cout << fixed << setprecision(10);

  string S1, S2;
  while (cin >> S1 && S1 != "."s) {
    cin >> S2;
    solve(S1, S2);
  }
  return 0;
}



Measured memory_bytes: 3172
// Author: Amey Bhavsar
// IDE: Geany/Ubuntu
// Platform: *

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

typedef long long ll;

#define rep(i,a,b) for(auto i=a;i<b;i++)
#define repD(i,a,b) for(auto i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal
// traversal function to avoid long template definition
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)
//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())
// ll fe (ll x, ll y) {
	// ll ans = 1;
	// while (y>0) {
		// if (y&1) {
			// ans = (x*ans) % MOD;
		// }
		// y /= 2;
		// x = (x*x) % MOD;
	// }
	// return (ans % MOD);
// }

// ll modmul(ll a, ll b) {
    // return ((a%MOD) * (b%MOD)) % MOD;
// }

// ll modadd(ll a , ll b){
    // return((a%MOD)+(b%MOD)+MOD)%MOD;
// }

// ll modsub(ll a , ll b){
    // return((a%MOD) - (b%MOD) + MOD)%MOD;
// }
#define MOD 1000000007

int main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	ll n,k;
	cin >> n >> k;
	ll ans = 0;
	while (n) {
		ans++;
		n /= k;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3616
fn main() {
    let n = read::<u64>();
    let x = n % 100;
    let q = n / 100;

    let minq = if x % 5 == 0 { x / 5 } else { x / 5 + 1 };

    yn(n >= 100 && minq <= q);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("1");
    } else {
        println!("0");
    }
}


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

int main() {
    int A, B; cin >> A >> B;
    if ((A % 3 == 0) || (B % 3 == 0) || ((A + B) % 3 == 0)) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long int n;
    cin >> n;
    long long int sum = 0;
    for(long long int i=1; i<=n; i++)
    {
        if((i%3 != 0 ) && (i%5 != 0))
            sum+=i;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3592
judgeString :: Ord a => a -> a -> String
judgeString a b | a > b = "a > b"
                | a < b = "a < b"
                | otherwise = "a == b"

main :: IO ()
main = getLine >>= putStrLn . (\xs -> judgeString (head xs) (head $ tail xs)) . map (read :: String -> Int) . words

Measured memory_bytes: 3604
#pragma comment(linker, "/stack:200000000")

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) return cout<<a,0;

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

typedef pair < int , int > pii ;
typedef pair < long long  , long long > pll ;
void solve(){
	int a , b;
	cin >> a >> b;
	int tot = a * b;

	if(a > b)
		swap(a , b);
	if(a == b){cout << 2ll * a - 2; return ;}
	if(a + 1 == b){cout << 2ll * a - 2; return ;}
	int l = 1 , r = tot, res = 1;
	while(l <= r){
		int m = (l + r) >> 1;
		if(m < (ld)tot /(ld)m)
			res = m , l = m + 1;
		else 
			r = m - 1;
	}	
	if(res * (res + 1) < tot){
		cout << 2 * res - 1;return;
	}
	else
		cout << 2 * res - 2;
	
}
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	int q;	cin >> q;
	while(q--)solve(),cout << '\n';
}

Measured memory_bytes: 256
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;

int main ( ){

  string s ;
  stack < char > st ;
  cin >> s;
  n = s.length() ;
  for ( int i = 0; i < s.length() ; i++ ){
    if ( st.size() && st.top() != s[i] ){
        st.pop();
        continue ;
    }
    st.push(s[i]);
  }
  cout << n-st.size() ;
return 0 ;
}


Measured memory_bytes: 512
import java.util._

object Main {
  def main(args: Array[String]) = {
    val scanner = new Scanner(System.in)
    val n = scanner.nextInt
    val m = scanner.nextInt
    val evenEven = n * (n - 1) / 2
    val oddOdd = m * (m - 1) / 2
    print(evenEven + oddOdd)
  }
}

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

const ll inf = 1e18L + 5;

void min_self(ll& a, ll b ){
    a = min(a, b);
}

int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int N, W;
    cin>>N>>W;

    vector<ll> weights(N);
    vector<ll> values(N);
    ll sum_value = 0;
    for( int i = 0; i < N; i++ ) {
        cin>>weights[i]>>values[i];
        sum_value += values[i];
    }

    vector<ll> dp( sum_value + 1, inf);
    dp[0] = 0;
    for( int i = 0; i < N; i++ ) {
        for( int j = sum_value-values[i]; j >= 0; j-- ) {
            min_self(dp[j + values[i]], dp[j] + weights[i]);
        }
    }

    ll res = 0;
    for( int j = 0; j <= sum_value; j++ ){
        if( dp[j] <= W )
            res = max(res, (ll)j);
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

int main() {
	int n;
	cin >> n;
	vector<int> A(n);
	Rep(i, n) cin >> A[i];
	int q;
	cin >> q;
	Rep(i, q) {
		int b, e;
		cin >> b >> e;
		reverse(Part(A, b, e));
	}
	Rep(i, n) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	return 0;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = false;
  ll n,m;cin>>n>>m;
  vector<string> s(n),t(m);
  for(i=0;i<n;i++)cin>>s[i];
  for(i=0;i<m;i++)cin>>t[i];

  for(i=0;i<n-m+1;i++)
  for(j=0;j<n-m+1;j++){
    bool judge2=true;
    for(ll p=i;p<i+m;p++)
    for(ll q=j;q<j+m;q++){
      if(s[p][q]!=t[p-i][q-j])judge2=false;
    }
    if(judge2){
      judge=true;
      break;
    }
  }

  ans1(judge);

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<ctype.h>

#define WIN 3;
#define DRAW 1;

int main(){
	
	int i,j,k,l;
	int num,result;
	int tp,hp;
	
	char tarou[1000][100]={0};
	char hanako[1000][100]={0};

	tp = hp = 0;
	
	scanf("%d",&num);
	for(i=0; i<num; i++){
		scanf("%s",&tarou[i][0]);
		scanf("%s",&hanako[i][0]);
	}
	
	for(i=0; i<num; i++){
		result = strcmp(&tarou[i][0],&hanako[i][0]);
		if( result > 0 ){
			tp += WIN;
		}else if( result < 0 ){
			hp += WIN;
		}else{
			tp += DRAW;
			hp += DRAW;
		}
	}
	
	printf("%d %d\n",tp,hp);
	
	return 0;
}


Measured memory_bytes: 2044
n,m=gets.split.map &:to_i
a=Array.new(n).map{|i|[]}
m.times do
  g,x=gets.split.map &:to_i
  a[g-1]<< x-1
  a[x-1]<< g-1
end
$a=a
$n=n
def d x,z
  y="%0#{$n}d"%x.to_s(2)
  c=0
  if x==2**$n-1
    c=1
  else
    $a[z].each do |e|
      if y[$n-1-e]==?0
        c+=d(x+2**e,e)
      end
    end
  end
  c
end
p d 1,0

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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

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

  int ans;
  std::cout << (N * (N - 1) + M * (M - 1)) / 2 << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lowb lower_bound
#define upb upper_bound
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

    int h, w;
    cin >> h >> w;
    int links[10][10];
    rep(i, 10) rep(j, 10) cin >> links[i][j];

    rep(k, 10) {
        rep(i, 10) {
            rep(j, 10) {
                chmin(links[i][j], links[i][k] + links[k][j]);
            }
        }
    }
    int ans = 0;
    rep(i, h * w) {
        int a;
        cin >> a;
        if(a < 0) continue;
        ans += links[a][1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
flag = True
for i in range(N):
    if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
        flag = False
        break
if flag:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
#define mod 200003
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; }
//(a+b-1)/b
//priority_queue<ll, vector<ll>, greater<ll>> q;
using pl = pair<ll,ll>;
using vvb=vector<vector<bool>>;
using vb= vector<bool>;
ll f(ll a,ll b,ll p){
	if(b==0) return 1;
	if(b%2==0){
		ll t=f(a,b/2,p);
		return t*t%p;
	}
	return a*(f(a,b-1,p))%p;
} 
//cout << fixed << setprecision(桁数);
//__builtin_popcount()
signed main(){
	ll n; cin>>n;
	vl vec(n+1);
	ll sum=0,ans=1e18;
	rep(i,1,n+1){
		ll a; cin>>a;
		vec[i]+=a;
		vec[i]+=vec[i-1];
		sum+=a;
	}
	rep(i,1,n+1){
		chmin(ans,abs(vec[i]-(sum-vec[i])));
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 4808
#include <iostream>
#include <stdio.h>

int main() {
    int a, b;
    const char *sign;

    scanf("%d %d", &a, &b);
    if (a < b) {
        sign = "<";
    } else if (a > b) {
        sign = ">";
    } else {
        sign = "==";
    }

    printf("a %s b\n", sign);

    return 0;
}

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(b/a,c)<<endl;
}

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

int main()
{
  string s;

  getline(cin,s);

  long int len = s.size(),i,j=0,k,sum=0,n[len+1],sum1=0;

for(i = 0; i <= len; i++)
    {
     if(i == 0 && s[i] == '<')
     {
     n[i] = 0;
     sum += n[i];
     }
else if(s[i-1] == '>' && s[i] == '<')
    {
     n[i] = 0;
     sum += n[i];
    }

else if(s[i-1] == '<' && s[i] == '<')
    {
    n[i] = n[i-1] + 1;
    sum += n[i];
    }

else if(i == len && s[i-1] == '>')
   {
     n[i] = 0;
     sum += n[i];
   }

}
for(i=len;i>=0;i--)
{
    if(i==len && s[i-1]=='<')
    {
        n[i] = n[i-1]+1;
        sum += n[i];
    }
    else if(s[i]=='>' && s[i-1]=='>')
    {
        n[i]=n[i+1] +1;
        sum += n[i];
    }
    else if(s[i] =='>'&&s[i-1] == '<')
    {
        if(n[i+1] > n[i-1])
        {
            n[i] = n[i+1]+1;
            sum += n[i];
        }
        else
        {
            n[i] = n[i-1]+1;
            sum += n[i];
        }
    }
    else if(i==0 && s[i] =='>')
    {
        n[i] = n[i+1]+1;
        sum += n[i];
    }
}
cout<<sum<<endl;

}


Measured memory_bytes: 4740
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n[5];
  for(int i = 0; i < 5; i++){
    cin >> n[i];
  }
  sort(n, n+5, greater<int>());
  for(int i = 0 ; i < 5; i++){
    if(i)cout << " ";
    cout << n[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1180
/**
 *    AUTHOR:    __SIGSEGV__                  
 *   CREATED:   12.08.2020 21:01:09  
**/

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long d;
  cin >> n >> d;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    long long dd = x * x + y * y;
    if (dd <= d * d) {
      ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>


#include <cstdio>
#include <queue>
#include <set>
#include <string>
#include <stdbool.h>
#include<ctime>

#include <cstring>

#define pb push_back
#define p push

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf ",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"

#define MOD  ( int)(1e9 + 7)
#define MAXN (ll) ((1e6+5))
#define K 25
#define  ALPHABET_SIZE  26
//#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int, int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph;


signed main(){
	IOS;

	ll n; 
	cin >> n;
	ll k = n * (n + 1) ;
	ll nn = n / 3;
	ll t = 3 * (nn * (nn + 1));
	k -= t;

	nn = n / 5;
	t = 5 * (nn * (nn + 1));
	k -= t;

	nn = n / 15;
	t = 15 * (nn * (nn + 1));
	k += t;
	cout << k / 2;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 3644
import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] ACTG = {"A","C","T","G"};
        String[] TGAC = {"T","G","A","C"};
        for (int i=0;i<4;i++){
            if (str.equals(ACTG[i])){
                System.out.println(TGAC[i]);
            }
        }
    }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define p 3.14159265358979323846
int main()
{
    ll s;cin>>s;ll n;cin>>n;ll sum=0;
    vector<ll>v(n);
    for(ll i=0;i<n;i++){
        cin>>v[i];
        sum+=v[i];
    }
    ll a=abs(sum-s);
    if(sum>s)
    cout<<"-1"<<endl;
    else
    {
        cout<<a<<endl;
    }
    

}

Measured memory_bytes: 3672
#include <iostream>
#include <climits>
#include <vector>
#include <queue>

#define MAX_V 1024
using namespace std;

void get_map();
void check();
struct edge
{
  int to;
  int weight;
};


const int INF = INT_MAX/4;
vector<edge> g[2000];
int graph[MAX_V][MAX_V];
int dist[MAX_V];
int numofedge;
int vertex;
int start;
int flag=0;

int main()
{
  get_map();
  check();
  //for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
	{
	  //if(i==j)
	    {
	      if(graph[start][j]<INF/2 && graph[j][j]<0)
		{
		  cout << "NEGATIVE CYCLE" <<endl;
		  return 0;
		}
	    }
	}
    }
  
    for(int i=0;i<vertex;i++)
      {
	if(graph[start][i]>=INF/2)
	  {
	    cout << "INF" << endl;
	  }
	else
	  {
	cout << graph[start][i] << endl;
	  }
      }
  return 0;
}

inline int fastmin(int a, int b)
{
  return (((a-b)>>31)&(a-b))+b;
}

void check()
{
  //  int next;
  //int here = start;
  //for(int i=0;i<vertex;i++)
  
  for(int k=0;k<vertex;k++)//v=4
    {
      for(int i=0;i<vertex;i++)
	{
	  int gik= graph[i][k];
	  for(int j=0;j<vertex;j++)
	    {
	      //if(graph[i][k] !=INF && graph[k][j]!=INF)
		{
	      graph[i][j]= min(graph[i][j], gik+graph[k][j]);
		}
	    }
	}
    }
  
}

void get_map()
{
  int edge, from ,to;
  cin >> vertex >> numofedge >> start;
  
  fill(graph[0], graph[vertex], INF);
  
  for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
      {
	if(i==j)
	  {
	    graph[i][j]=0;
	  }
	/*else
	  {
	    graph[i][j]=INF;
	    }*/
      }
    }

  /*for(int i=0;i<vertex;i++)
    {
      dist[i]=INF;
    }
  */
  for(int i=0;i<numofedge;i++)
    {
      cin>>from>>to;
      cin >> graph[from][to];
    }

  /*  for(int i=0;i<numofedge;i++)
    {
      int from, to, weight; 
      cin >> from >> to >> weight;
      g[from].push_back({to , weight});
   }
  */  

  /*  for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
	{
	  cout << graph[i][j] << " ";
	}
      cout << endl;
      }*/
  // dist[start]=0;
  
  /*  cout << vertex << endl;
  for(int i=0;i<vertex;i++)
    {
      for(int j=0;j<vertex;j++)
	{
	  cout << graph[i][j] << " ";
	}  
      cout << endl;    
      }*/
  

}

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

int main(){
	int N; cin >> N;
	vector<vector<int>> A(2, vector<int>(N+1));

	for(auto &row: A) for(int i=1; i<=N; i++) cin >> row[i];
	
	for(int i=0; i<2; i++)
		for(int j=0; j<N; j++)
			A[i][j+1] += A[i][j];

	int ans = 0;
	for(int i=1; i<=N; i++)
		ans = max(ans, A[0][i] + A[1][N]-A[1][i-1]);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
G = [[] for i in range(n)]
for i in range(m):
    x, y = map(lambda z: int(z)-1, input().split())
    G[x].append(y)

ans = [-1]*n
def dfs(i):
    if ans[i] != -1:
        return ans[i]
    if len(G[i]) == 0:
        ans[i] = 0
        return ans[i]
    res = 0
    for j in G[i]:
        res = max(res, dfs(j))
    ans[i] = res + 1
    return ans[i]

for i in range(n):
    dfs(i)

print(max(ans))


Measured memory_bytes: 59056
#include <stdio.h>

#define MAX 10000
#define NIL -1

typedef struct { int parent, left, right;} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u,int d) {
  if(u == NIL) return;
  D[u] = d;
  setDepth(T[u].left, d+1);
  setDepth(T[u].right,d+1);
}

int setHeight(int u) {
  int h1 = 0, h2 = 0;
  if(T[u].left != NIL)
    h1 = setHeight(T[u].left)  + 1;
  if(T[u].right != NIL)
    h2 = setHeight(T[u].right) + 1;
  return H[u] = (h1 > h2 ? h1 : h2);
}

// 接点 u の兄弟を返す
int getSibling(int u) {
  if(T[u].parent == NIL) return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
    return T[T[u].parent].right;
  return NIL;
}

void print(int u) {
  int deg = 0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  if(T[u].left  != NIL) deg++;
  if(T[u].right != NIL) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  
  if(T[u].parent == NIL) {
    printf("root\n");
  } else if(T[u].left == NIL && T[u].right == NIL) {
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

int main(void) {
  int i, v, l, r, root = 0;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].parent = NIL;
  for(i=0;i<n;i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].left  = l;
    T[v].right = r;
    if(l != NIL) T[l].parent = v;
    if(r != NIL) T[r].parent = v;
  }
  
  for(i=0; i<n; i++)
  if(T[i].parent == NIL) root = i;
  
  setDepth(root,0);
  setHeight(root);
  
  for(i=0;i<n;i++) print(i);
  
  return 0;
}


Measured memory_bytes: 2744