akhauriyash/Code-Regression huggingface dataset:
// Created by sz
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 1e5 + 5;
int n;

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int k,x;
    cin >> k >> x;
    
    for (int i = -k+1; i <= k-1; i++){
        cout << x + i << " \n"[i == k-1];
    }
    
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)
n = int(input())
# n = 10000
d = [set() for i in range(n)]
cost = {}
for i in range(n-1):
    u,v,w = map(int,input().split())
    # u,v,w = i,i+1,i
    d[u-1].add(v-1)
    d[v-1].add(u-1)
    cost[(u-1,v-1)] = w%2
    cost[(v-1,u-1)] = w%2

visited = [False for i in range(n)]
colors = [0 for i in range(n)]

stack = []
def dfs(v,c):
    visited[v] = True
    colors[v] = c%2
    for i in d[v]:
        if not visited[i]:
            dfs(i,c+cost[(v,i)])

dfs(0,0)

for i in range(n):
    print(colors[i])

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

#define ll long long
#define pb push_back
#define eb emplace_back
#define REP(i, n) for(int i=0;i<(n);++i)
#define caset int ___T; cin >> ___T; while(___T--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define fast_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"

int main() {
	fast_IO;

	ll int n, d;
	cin >> n >> d;

	d *= d;

	ll int x, y;
	ll int ans = 0;
	REP(i, n) {
		cin >> x >> y;
		if (x*x + y*y <= d) {
			++ans;
		}
	}

	cout << ans << endl;

	cout << flush;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n,m;
vector<int> aaa;
vector<vector<int> > g;
int dfs(int v){
    if(aaa[v]!=-1)
        return aaa[v];
    aaa[v]=0;
    for(int i=0;i<g[v].size();i++){
        int u=g[v][i];
        aaa[v]=max(aaa[v],dfs(u)+1);
    }
    return aaa[v];
}
int main(){
    cin>>n>>m;
    g.resize(n);//省空间秘籍 
    aaa=vector<int>(n,-1);
    for(int i=0;i<m;i++){
        int x,y;
        cin>>x>>y;
        x--,y--;
        g[x].push_back(y);
    }
    int ans=0;
    for(int i=0;i<n;i++)
        ans=max(ans,dfs(i));
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 8192
#include<iostream>
int main(){
    
    int a;
    std::cin>> a;
    constexpr size_t S_LENGTH_MAX = 11;
    char s[S_LENGTH_MAX];
    std::cin>> s;


    if(a>=3200){
        std::cout<< s<<std::endl;
    }else{
       std::cout<< "red" <<std::endl;
    }

    return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A + B == C || A + C == B || B + C == A){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

int n;
int s[100];

int solve() {
  int ret = 0;
  vector< vector<int> > dp( n, vector<int>(10,-1) );

  for(int i = 0;i < n;i++) {
    if(i > 0) {
      for(int j = 0;j < 10;j++) { dp[i][j] = dp[i-1][j]; } // init

      for(int j = 0;j < 10;j++) {
        if( dp[i-1][j] == -1 ) { continue; } // no value

        if( dp[i][(j + s[i]) % 10] < dp[i-1][j] + s[i] ) {
          dp[i][(j + s[i]) % 10] = dp[i-1][j] + s[i];
        }
      } // for all mods
    }

    if( dp[i][s[i] %10] == -1 ) { dp[i][s[i] %10] = s[i]; } // no value
  } // for all s[i] elements

  for(int i = 1;i < 10;i++) { if(ret < dp[n-1][i]) ret = dp[n-1][i]; }
  return ret;
}


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

  cout << solve() << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int k;
    int sum=0;
    cin >> k;
    rep2(a,1,k+1){
        rep2(b,1,k+1){
            rep2(c,1,k+1){
                sum+= __gcd(a,__gcd(b,c));
            }
        }
    }

    cout << sum;

    return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
		int n = scan.nextInt(); // ??´??°?????° n
		int min     = 1000000;
        	int max     = -1000000;
        	long sum   = 0;
		for(int i = 0;i < n;i++){
			int num = scan.nextInt(); // ??´??°??\???
			sum += num;
			if(min > num){min = num;}
			if(max < num){max = num;}
		}
	System.out.println(min + " " + max + " " + sum);
	}
}

Measured memory_bytes: 42272
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

inline void readChar(char &c) {
	for (c = getchar(); c != '.' && c != '#'; c = getchar());
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
	int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

const int MAXN = 2e5;
int n, a, b, c, d, cnt, lastRock;
char s[MAXN + 5];

int main() {
	read(n), read(a), read(b), read(c), read(d);
	if (d < c) swap(a, b), swap(c, d);//确保 d > c 
	for (int i = 1; i <= n; ++i) readChar(s[i]);
	for (int i = a; i <= c; ++i)
		if (s[i] == '#' && s[i - 1] == '#') {
			puts("No");
			return 0;
		}
	for (int i = b; i <= d; ++i)
		if (s[i] == '#' && s[i - 1] == '#') {
			puts("No");
			return 0;
		}
	if (a < b) {//b 先到 d，a 再到 b 
		puts("Yes");
		return 0;
	}
	for (int i = a; i <= c; ++i)//让 a 到一个合适的位置，使 b 能够到达 d
		if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
			puts("Yes");
			return 0;
		}
	puts("No");
	return 0;
}

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

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  int k;
  int a, b;
  cin >> k;
  cin >> a >> b;
  if (a % k == 0 || b % k == 0) {
    cout << "OK" << endl;
    return 0;
  }
  int c = a/k;
  if (k*(c+1) <= b) {
    cout << "OK" << endl;
    return 0;
  }
  cout << "NG" << endl; 
  return 0;
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
const int N = 81;
int a[N][N];
int b[N][N];
bool dp[N][N][2*N*N];
void solve(){
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            cin >> a[i][j];
        }
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            cin >> b[i][j];
        }
    }
    dp[1][1][abs(a[1][1] - b[1][1])] = true;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            int d = abs(a[i][j] - b[i][j]);
            for (int k = 0; k < 2*N*N; ++k) {
                dp[i][j][k] |= dp[i-1][j][abs(k - d)];
                dp[i][j][k] |= dp[i-1][j][abs(k + d)];
                dp[i][j][k] |= dp[i][j-1][abs(k + d)];
                dp[i][j][k] |= dp[i][j-1][abs(k - d)];
            }
        }
    }
    for (int i = 0; i <= 80; ++i) {
        if (dp[n][m][i]) {
            cout << i;
            return;
        }
    }
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 83328
N = int(input())
B = list(map(int,input().split()))

ans = []
while B:
    for i,a in reversed(list(enumerate(B))):
        if i+1 == a:
            ans.append(a)
            del B[i]
            break
    else:
        print(-1)
        exit()
print(*ans[::-1], sep='\n')

Measured memory_bytes: 3060
import itertools

n = int(input())

l = [0]*5
for i in range(n):
    s = input()
    if s[0] == "M":
        l[0] += 1
    if s[0] == "A":
        l[1] += 1
    if s[0] == "R":
        l[2] += 1
    if s[0] == "C":
        l[3] += 1
    if s[0] == "H":
        l[4] += 1 

ans = 0
for a,b,c in itertools.combinations(l,3):
    ans += a*b*c

print(ans)    

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((V).begin(), (V).end())
#define RSORT(v) sort((V).rbegin(), (V).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (V.erase(remove((V).begin(), (V).end(), (a)), (V).end()))
#define REVERSE(v) (reverse((V).begin(), (V).end()))
#define LOWER_BOUND(v,a) (lower_bound((V).begin(), (V).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((V).begin(), (V).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

signed main()
{
	int n, a, b;
	cin >> n >> a >> b;
	if (a * n < b)
	{
		cout << (a*n) << endl;
	}
	else
	{
		cout << b << endl;
	}
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int N; cin >> N;
	string S; cin >> S;
	map<char, int> cnt;
	rep(i, 0, S.size())cnt[S[i]]++;
	lli ans = 1;
	for (map<char, int>::iterator it = cnt.begin(); it != cnt.end(); it++)
		ans = (ans * ((lli)it->second + 1)) % MOD;
	ans--;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define pb  					push_back
#define mp 						make_pair
#define all(v) 					((v).begin()) ,((v).end())
#define let(o,v)				memset(o,v,sizeof (o))
typedef long long 				ll;
typedef vector<int>				vi;
typedef vector<vi>				vvi;
typedef vector<string>			vs;
const int N = (int)2750131;
const int MOD = 1e9 + 7;
const int oo = (int)1e9;
const ll OO = (ll)1e18;
const double PI = acos(-1.0);


bool isprime(int n) {
	if (n <= 1)
		return 0;
	for (int i = 2; i*i <= n; i++)
		if (n%i == 0)
			return false;
	return 1;
}
ll intlog(ll base, ll x) {
	return (log(x) / log(base));
}
bool prime[N];
vector<int> next_primee;
void primee()
{
	let(prime, 1);
	for (int p = 2; p*p <= N; p++)
	{

		if (prime[p] == true)
		{
			for (int i = p * 2; i < N; i += p)
				prime[i] = false;
		}
	}

}
string decToBinary(ll n)
{
	string z = "";
	int i = 0;
	while (n > 0) {

		z += (n % 2) + 48;
		n = n / 2;
		i++;
	}
	reverse(all(z));
	return z;
}
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll power(ll x, int y)
{
	ll temp;

	if (y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp*temp;
}
int get(int num) {
	for (int i = 2; i * i <= num; i++)
	{
		if (num%i == 0) return num / i;
	}
	return 0;
}
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	if (k == 1) puts("0");
	else printf("%d\n", n - k);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define MAX 305

ll n;
ld dp[MAX][MAX][MAX];

ld solve(ll a, ll b, ll c)
{
    if (a < 0 || b < 0 || c < 0)
        return 0;
    if (a + b + c == 0)
        return 0;
    
    if (dp[a][b][c] == -1)
        dp[a][b][c] = ((ld) n / (ld) (a + b + c)) + (ld) ((a * solve(a - 1, b, c)) + (b * solve(a + 1, b - 1, c)) + (c * solve(a, b + 1, c - 1))) / (ld) (a + b + c);
    return dp[a][b][c];
}

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

    for (int i = 0; i < MAX; i++)
        for (int j = 0; j < MAX; j++)
            for (int k = 0; k < MAX; k++)
                dp[i][j][k] = -1;

    cin >> n;
    ll a = 0, b = 0, c = 0;

    for (int i = 0; i < n; i++)
    {
        ll x;
        cin >> x;

        if (x == 1)
            a++;
        else if (x == 2)
            b++;
        else
            c++;
    }

    cout << fixed << setprecision(10) << solve(a, b, c) << "\n";
}


Measured memory_bytes: 443648
# -*- coding:utf-8 -*-
d = { 'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15 }
x, y = input().split()
if d[x] > d[y]:
    print(">")
elif d[x] < d[y]:
    print("<")
else:
    print("=")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a[100010]={};
int main(){
    int n,k,q;
    cin>>n>>k>>q;
    int x;
    int Q=q;
    while(q--){
        cin>>x;
        a[x]++;
    }
    for(int i=1;i<=n;++i){
        if((Q-a[i])>=k)puts("No");
        else puts("Yes");
    }
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll fac(ll a) { return a > 1 ? fac(a - 1) * a : 1; }
ll fang(ll a){
  return a > 1 ? fang(a - 1) + a : 1;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  int n;
  cin >> n;
  long double x;
  string s;
  long double ans = 0;
  rep(i,n){
    cin >> x >> s;
    if(s == "BTC")ans += (long double)x * (long double)380000;
    else ans += x; 
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> v(n);
        for (int i=0; i<n; ++i) {
            cin >> v[i];
        }
        int res = 0;
        for (int i=0; i<n-1; ++i) {
            for (int j=0; j<n-1; ++j) {
                if (v[j] > v[j+1]) {
                    swap(v[j], v[j+1]);
                    res ++;
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
n,m = map(int,input().split())

# n + x : m - 2 * x = 1 : 2
# 2n+2x = m - 2x
# 4x = m-2n

if n * 2 <= m:
    l = (m - 2 * n) // 4
    ans1 = min(n+l, (m-l*2)//2)
    ans2 = min(n+l+1, (m - (l+1)*2)//2)
    print(max(ans1, ans2))

else:
    print(m//2)


Measured memory_bytes: 2940
/* include */
#include <bits/stdc++.h>
#include <boost/algorithm/string/trim.hpp>
#include <boost/range/algorithm.hpp>

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x)  \
    boost::sort(x); \
    (x).erase(unique(all(x)), (x).end())
#define mp make_pair

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    string s;
    cin >> s;
    sort(all(s));
    if (s[0] == s[1] && s[2] == s[3] && s[0] != s[3])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double arra[n+5];
    for(int i=0; i<n; i++)
    {
        cin>>arra[i];
    }
    double dp[n+5][n+5];
    for(int i=0; i<=n; i++)
    {
        for(int j=0; j<=n; j++)
        {
            dp[i][j]=0.0;
        }
    }
    dp[0][0]=1.0;
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<=i; j++)
        {
            if(j==0)
            {
                dp[i][j]=dp[i-1][j]*(1-arra[i-1]);

            }
            else
            {
                dp[i][j]=dp[i-1][j]*(1.0-arra[i-1])+dp[i-1][j-1]*arra[i-1];


            }
        }
    }
    double tota=0.0;
    for(int i=(n/2)+1; i<=n; i++)
    {
        // printf("%.10lf\n",dp[n][i]);
        tota+=dp[n][i];

    }

    printf("%.10lf\n",tota);


}


Measured memory_bytes: 74176
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN [IUT CSE(SWE)-19]

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

#define fastio          ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define read            freopen("blue.txt","r",stdin);
#define write           freopen("red.txt","w",stdout);

using ll=long long;
using ull=unsigned long long;
const double pi = 2*acos(0.0);


int  main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n+1];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    
    ll sum=0;
    
    for(ll i=0;i<k;i++)
    {
        sum=sum+a[i];
    }
    
    cout<<sum;


    return 0;


}


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

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  vector<int> D = {A,B,C};
  sort(D.begin(),D.end());
  if ( D.at(1) == C )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

using namespace std;

int  main()
{
    string a, b;
    cin>>a>>b;
    //a = '0'+a;
    //b = '0'+b;
    int la = a.length() , lb = b.length();
    vector<vector<int> > LCS(lb+1, vector<int> (la+1));
    vector<vector<char> > B(lb+1, vector<char> (la+1));
    for(int i=0; i<=lb; i++)
    {
        for(int j=0; j<=la; j++)
        {
            if(i==0 || j==0)
                {LCS[i][j] = 0;
                   B[i][j] = '*';}
            else if (a[j-1] == b[i-1])
            {
                LCS[i][j] = 1 + LCS[i-1][j-1];
               B[i][j] = 'D';
            }
            else
                {
                    if(LCS[i-1][j] >= LCS[i][j-1])
                       {
                         LCS[i][j]=LCS[i-1][j];
                         B[i][j] = 'U';
                       }
                    else
                       {
                          B[i][j] = 'L';
                       LCS[i][j]=LCS[i][j-1];
                       }

            }
    }
    }
   /* for(int i=0; i<=lb; i++)
    {
        for(int j=0; j<=la; j++)
        {
            cout<<LCS[i][j]<<" ";
        }
        cout<<"\n";
    }
    cout<<"\n";
    for(int i=0; i<=lb; i++)
    {
        for(int j=0; j<=la; j++)
        {
            cout<<B[i][j]<<" ";
        }
        cout<<"\n";
    }
    cout<<"\n";*/
    string s="";
    int i = lb , j = la;
    while(B[i][j]!='*')
    {
        if(B[i][j]=='D')
        {
            s+=a[j-1];
            i--;
            j--;
        }
        else if (B[i][j]=='U')
            i--;
        else
            j--;
    }
    reverse(s.begin(), s.end());
    cout<<s;

    return 0;
}


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

int main() {
  int h, w, n;
  cin >> h;
  cin >> w;
  cin >> n;
  int ans = 0;
  if (h < w) {
    ans = (n + w - 1)/w;
  }
  else {
    ans = (n + h - 1)/h;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
	int n = int.Parse(ReadLine());
	string s = ReadLine();

	if (n%2 == 1){ WriteLine("No"); return; }

	for (int i = 0; i < n/2; i++)
	{
	    if (s[i] != s[i + n/2])
	    {
		WriteLine("No");
		return;
	    }
	}

	WriteLine("Yes");
    }
}

Measured memory_bytes: 13140
#include <iostream> //üoÍ

using namespace std;

int main(){
	double n;
	cin >> n;
	double max = n;
	double min = n;
	
	while(cin >> n){
		if(n >= max ){
			max = n;
		}else if(n < min){
			min = n;
		}
	}
	
	cout << max - min << endl;
		
	return 0;
	
}

Measured memory_bytes: 0
using System;
using System.Linq;
class aoj
{
    static void Main()
    {
        int[] c = new int[8];
        c[0] = 1;c[1] = 2;c[2] = 1;c[3] = 2;c[4] = 1;c[5] = 4;c[6] = 1;c[7] = 4;
        while (true)
        {
            string a = Console.ReadLine();
            if (String.IsNullOrEmpty(a)) break;
            int[] b = a.Split(' ').Select(int.Parse).ToArray();
            int[] f = new int[3];
            f[0] = 1000000000;
            for (int i = 0; i < 8; i++)
            {
                int e = 0;
                char[] h = new char[8];
                for (int j = 0; j < 8; j++)
                {
                    int d = j + i;
                    if (d >= 8)
                        d -= 8;
                    int g = b[j] - c[d];
                    if (g < 0)
                        g = 0;
                    e += g;
                    h[j] = (char)(c[d] + '0');
                }
                if (f[0] > e)
                {
                    f[0] = e;
                    f[1] = i;
                    string k = new string(h);
                    f[2] = int.Parse(k);
                }
                if (f[0] == e)
                {
                    string k = new string(h);
                    int l = int.Parse(k);
                    if (f[2] > l)
                    {
                        f[1] = i;
                        f[2] = l;
                    }
                }
            }
            int m = f[1];
            for (int i = 0; i < 8; i++)
            {
                int n = m + i;
                if (n >= 8)
                    n -= 8;
                if (i == 0)
                    Console.Write(c[n]);
                else
                    Console.Write(" " + c[n]);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9436
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  int X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<long long> p(A), q(B), r(C), te(X + Y + C);
  for(int i = 0; i < A; i++)
    cin >> p[i];
  for(int i = 0; i < B; i++)
    cin >> q[i];
  for(int i = 0; i < C; i++)
    cin >> r[i];
  sort(p.begin(), p.end());
  sort(q.begin(), q.end());
  long long sum = 0;
  int a = A - 1, b = B - 1, c = 0;
  for(int j = 0; j < X; j++){
    te[j] = p[a];
    a--;
    //cout << te[j] << endl;
  }
  for(int j = 0; j < Y; j++){
    te[X + j] = q[b];
    b--;
    //cout << te[X + j - 1] << endl;
  }
  for(int j = 0; j < C; j++){
   te[X + Y + j] = r[j];
    //cout << te[X + Y + j - 1] << endl;
  }
  sort(te.begin(), te.end());
  for(int j = 0; j < X + Y; j++){
    sum += te[X + Y + C - j - 1];
    //cout << sum << endl;
  }
  cout << sum;
  return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void write(int x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
int a;
int main(){
	read(a);
	printf("%.10lf",(double)((a+1)/2)/(double)(a));
}

Measured memory_bytes: 256
n = gets.to_i
aArr = gets.split.map(&:to_i).sort
ai = aArr[n-1]
diff = 2* 10**9 +1
aj = nil
aArr.each do |a|
  if (ai - a*2).abs < diff
    diff = (ai - a*2).abs
    aj = a
  else
    break
  end
end
printf("%d %d\n",ai,aj)

Measured memory_bytes: 10112
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main()
{
  int n;
  cin>>n;
  ll sum[n+1],tmp[n+1];
  sum[0]=0,tmp[0]=0;
  rep(i,n)
  {
    int a;
    cin>>a;
    sum[i+1]=sum[i]+a;
    tmp[i+1]=sum[i+1];
  }


  ll cnt1=0,det=0;
  //偶数項が正になる場合
  rep(i,n)
  {
    sum[i+1]+=det;
    if((i+1)%2==0)
    {
      if(sum[i+1]<=0)
      {
        cnt1+=(-sum[i+1]+1);
        det+=(-sum[i+1]+1);
      }
    }
    else
    {
      if(sum[i+1]>=0)
      {
        cnt1+=(sum[i+1]+1);
        det+=(-sum[i+1]-1);
      }
    }
  }

  rep(i,n+1) sum[i]=tmp[i];
  ll cnt2=0;
  det=0;
  //奇数項が正になる場合
  rep(i,n)
  {
    sum[i+1]+=det;
    if((i+1)%2==1)
    {
      if(sum[i+1]<=0)
      {
        cnt2+=(-sum[i+1]+1);
        det+=(-sum[i+1]+1);
      }
    }

    else
    {
      if(sum[i+1]>=0)
      {
        cnt2+=(sum[i+1]+1);
        det+=(-sum[i+1]-1);
      }
    }
  }

  cout<<min(cnt1,cnt2)<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast_io()  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {
	fast_io();
	ll t=1; //cin>>t;
	while(t--){
	    ll n,i; cin>>n;
	    vector<string> a(n);
	    for(i=0;i<n;i++) cin>>a[i];
	    cout<<"AC"<<" x "<<count(a.begin(),a.end(),"AC")<<endl;
	    cout<<"WA"<<" x "<<count(a.begin(),a.end(),"WA")<<endl;
	    cout<<"TLE"<<" x "<<count(a.begin(),a.end(),"TLE")<<endl;
	    cout<<"RE"<<" x "<<count(a.begin(),a.end(),"RE")<<endl;
 
	}
	return 0;
}


Measured memory_bytes: 6376
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int p, q, r;
    cin >> p >> q >> r;
    int ans = p + q + r;
    int m = max(p, q);
    m = max(m, r);
    cout << ans - m << endl;
    return 0;
}

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

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,x); REP(i,sizeof(a)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  for(int i=1;i<=9;++i){
    for(int j=1;j<=9;++j){
      printf("%dx%d=%d\n",i,j,i*j);
    } 
  }
}





Measured memory_bytes: 3128
from itertools import combinations
n = int(input())
l = list(map(int, input().split()))
comb = list(combinations(range(n), 3))
ans = 0
for i,j,k in comb:
    a = l[i]
    b = l[j]
    c = l[k]

    if a == b:
        continue
    if b == c:
        continue
    if c == a:
        continue
    if sum([a,b,c]) <= 2 * max(a,b,c):
        continue
    ans += 1
print(ans)


Measured memory_bytes: 20536
## for use in beginner level questions where speed is key
## and also for single test case code
## mastercopy for x,y,z

import sys
import heapq, functools, collections
import random
from collections import Counter, defaultdict

# read line as a string
# strr = input()

# read line as an integer
k = int(input())

# read one line and parse each word as a string
# lst = input().split()

# read one line and parse each word as an integer
# arr = list(map(int,input().split()))

import operator as op
from functools import reduce

def ncr(n, r, p): 
    # initialize numerator 
    # and denominator 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  p - 2, p)) % p 

if k <= 2:
    print(0)
    sys.exit()

if k == 3:
    print(1)
    sys.exit()

partitions = 1
res = 0
MOD = 10**9 + 7

while partitions*3 <= k:
    intervals = k - partitions*2
    val = ncr(intervals-1, partitions-1, MOD)
    # print(intervals-1, partitions-1, partitions, val)
    res += val
    partitions = partitions + 1

print(res%MOD)

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

int main() {
  long long a,b, c,d,sum=0, mod=2019;
  cin>>a>>b>>c>>d;
  
  while(a>0){
    c-=b;
    a-=d;
  }
  if(c<=0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define all(a) begin(a),end(a)
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

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

int main()
{   _
    string s; cin >> s;
    if(s.back() == 's') cout << s << "es" << ENDL;
    else cout << s << "s" << ENDL;
    return 0;
}


Measured memory_bytes: 3648
import java.util.*;

public class Main {

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

    String[] c = new String[h];

    for (int i = 0; i < h; i++) {
      c[i] = sc.next();
    }

    for (int i = 0; i < h; i++) {
      System.out.println(c[i]);
      System.out.println(c[i]);
    }


  }

}


Measured memory_bytes: 23636
def main(n):
  if n%2==0:
    print(n,n,n//2)
    exit()
  if n==3:
    print(2,2,3)
    exit()
  s=n//4
  for i in range(2*s,3500*2):
    for a in range(s,i-3):
      b=i-a
      c=a*b*n/(4*a*b-n*b-n*a)
      if float.is_integer(c) and c>0:
        print(a,b,int(c))
        exit()

if __name__=='__main__':
  import sys
  input = sys.stdin.readline
  n=int(input())
  main(n)

Measured memory_bytes: 39280
#!/usr/bin/env python3
import sys


def solve(H: int, W: int, h: int, w: int):
    print((H - h) * (W - w))
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    h = int(next(tokens))  # type: int
    w = int(next(tokens))  # type: int
    solve(H, W, h, w)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        long D = sc.nextLong();
        long A = sc.nextLong();
        ArrayDeque<Entry<Long, Long>> dex = new ArrayDeque<Entry<Long, Long>>();
        long del = 0;
        ArrayList<Entry<Long, Long>> list = new ArrayList<Entry<Long, Long>>(N);
        for (int i = 0; i < N; i++) {
            long a = sc.nextLong();
            long b = sc.nextLong();
            list.add(new SimpleEntry<Long, Long>(a, b));
        }
        Collections.sort(list, Comparator.comparing(Entry<Long, Long>::getKey));
        for (int i = 0; i < N; i++) {
            Entry<Long, Long> entry = list.get(i);
            long pos = entry.getKey() + D;
            while (!dex.isEmpty() && dex.peek().getKey() < entry.getKey())
                del -= dex.poll().getValue();
            long h = entry.getValue() - del;
            long cnt = h / A + (h % A != 0 ? 1 : 0);
            if (h > 0 && cnt > 0) {
                ans += cnt;
                del += cnt * A;
                dex.add(new SimpleEntry<Long, Long>(pos + D, cnt * A));
                // System.err.println(pos + " " + del + " " + h);
            }
        }
        System.out.println(ans);
    }

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

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
}

Measured memory_bytes: 141464
// I started this code in 2009 and just found it now!  What was your problem, 2009 self?  YOU GOTTA FINISH WHAT YOU START
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(int)(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(int)(a);i--)
template<typename T> ostream& operator<<(ostream& s, vector<T> t) {rep(i, 0, t.size()) s << (i ? " " : "") << t[i]; return s;}
template<typename T> istream& operator>>(istream& s, vector<T> &t) {rep(i, 0, t.size()) s >> t[i]; return s;}
template<typename T, typename U> ostream& operator<<(ostream& s, pair<T, U> t) {s << "(" << t.first << "," << t.second << ")"; return s;}
template<typename T, typename U> istream& operator>>(istream& s, pair<T, U> &t) {s >> t.first >> t.second; return s;}
typedef long long ll;


int main() {
    ios_base::sync_with_stdio(false);
    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    cin >> a;
    ll res = k;
    rep(i, 0, n - 1) {
        res += min(k, a[i + 1] - a[i]);
    }
    cout << res << endl;
}


Measured memory_bytes: 1792
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define buf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double dob;
#define MAX 50010
#define M5 100009
#define M6 2000009
#define M 1000000007
#define inf LLONG_MAX
using namespace std;
typedef vector<ll> V;
typedef queue<ll > Q;
typedef stack<ll> S;
typedef pair<ll,ll> P;
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
ll fac[M6],not_prime[M6];
ll power(ll x,ll n){
    if(n==0) return 1;
    /*while(n){
        if(n%2) x=(((x*x)%M)*x)%M; 
        else x=(x*x)%M;
        n/=2;
    }*/
    if(n%2 == 0) return power((x*x),n/2);
    else return (x*power((x*x),(n-1)/2));
}
void fact(){
    fac[0]=1;
    for(ll i=1;i<M6;i++) fac[i]=(i*fac[i-1])%M;
}
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<M6;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=M6;i+=p) not_prime[i]=1;
        }
    }
}
ll modi(ll a, ll m){
    ll m0 = m, t, q; ll x0 = 0, x1 = 1;
    if (m == 1) return 0;
    while (a > 1){  q = a / m; t = m; m = a % m, a = t;t = x0;x0 = x1 - q * x0; x1 = t;}
    if (x1 < 0) x1 += m0;return x1;
}
ll n,m,ar[M6],tim[M6],x[M6],y[M6];
int main(){
    buf; 
    //fact();
    //sieve();
    ll i,j,k,l,test,flag,ans; string s1,s2;
    //cin>>test;
    test=1;
    while(test--){
    	cin>>n;
    	for(i=1;i<=n;i++) cin>>tim[i]>>x[i]>>y[i];
    	ll px=0,py=0,it=0;
    	for(i=1;i<=n;i++){
    		k=abs(px-x[i])+abs(py-y[i]); l=tim[i]-it;
    		if(k<=l&&(k%2==l%2)){
    			px=x[i]; py=y[i]; it=tim[i];
    			continue;
    		}
    		else {
    			cout<<"No"; return 0;
    		}
    	}
    	cout<<"Yes";
    }
    return 0;
} 

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int a[10000];
char m[27];

void make()
{
    int i=1;
    for(i=1;i<27;i++)
        m[i]='a'+(i-1);
    m[0]='z';
}

int main()
{
    ll N;
    make();
    while(cin>>N)
    {
        int i;
        for(i=0;N;i++)
        {
            int m=N%26;
            if(m==0)
                m=26;
            a[i]=m;
            N=(N-m)/26;
        }
        for(i=i-1;i>=0;i--)
            printf("%c",m[a[i]]);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 3632
K = int(input())

GCD = [[0]*200 for i in range(200)]
def gcd(x, y):
    if GCD[x-1][y-1] == 0:
        if y == 0:
            return x
        else:
            return gcd(y, x % y)
    else:
        return GCD[x-1][y-1]

tot = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        s = gcd(i, j)
        if s != 1:
            for k in range(1, K+1):
                t = gcd(k, s)
                tot += t
        else:
            tot += K
print(tot)


Measured memory_bytes: 9484
import scala.io.StdIn.readLine

object Main {

  def main(args: Array[String]) = {
      val n = readLine().split(" ").map(_.toInt)
      println( if(n(0) > n(1)) "a > b" else if (n(0) < n(1)) "a < b" else "a == b")
  }
}

Measured memory_bytes: 43500
#include<stdio.h>

int main(void){
int n,a,b,c;
int i;
scanf("%d",&n);
for(i=0;i<n;i++){
  scanf("%d %d %d",&a,&b,&c);

  if(a*a + b*b ==c*c || b*b + c*c == a*a || a*a + c*c == b*b){
    printf("YES\n");
  }else {
    printf("NO\n");
  }
}
return 0;
}

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

void Print(string s, int a, int b){
    for(int i=a; i<=b; i++){
        cout<<s[i];
    }
    cout<<endl;
}

string Reverse(string s, int a, int b){
    int i=a;
    int j=b;
    while(i<j){
        swap(s[i],s[j]);
        i++;
        j--;  
    }
    return s;
}

string Replace(string s, int a, int b, string t){
    for(int i=a; i<=b; i++){
        s[i]=t[i-a];
    }
    return s;
}

int main(void){
    string str,command,t;
    int a,b,q;
    cin>>str>>q;
  
    for(int i=0; i<q; i++){
        cin>>command>>a>>b;
        if(command=="print"){
            Print(str,a,b);
        }else if(command=="reverse"){
            str=Reverse(str,a,b);
        }else{
            cin>>t;
            str=Replace(str,a,b,t);
        }
    }
    return 0;
}


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

int main(){
  int64_t N, M;
  cin >> N >> M;
  vector<int64_t> A(N);
  for(int64_t i=0; i<N; i++){
    cin >> A.at(i);
  }
  vector<pair<int64_t, int64_t>> P(M);
  vector<int64_t> B(M), C(M);
  for(int64_t i=0; i<M; i++){
    cin >> B.at(i) >> C.at(i);
    P.at(i)=make_pair(10-C.at(i), B.at(i));
  }
  sort(P.begin(), P.end());
  for(int64_t i=0; i<M; i++){
    P.at(i).first=10-P.at(i).first;
  }
  sort(A.begin(), A.end());
  int64_t S=0;
  for(int64_t i=0; i<M; i++){
    S+=B.at(i);
  }
  int64_t k=0;
  for(int64_t i=0; i<M; i++){
    for(int64_t j=0; j<P.at(i).second; j++){
      if(k>=N){
        goto end;
      }
      else{
      	A.at(k)=max(A.at(k), P.at(i).first);
      	k++;
      }
    }
  }
end: k=0;
  int64_t Ans=0;
  for(int64_t i=0; i<N; i++){
    Ans+=A.at(i);
  }
  cout << Ans << endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vl vector<long>
#define P pair<int,int>
using namespace std;

main()
{
        int n,k; cin>>n>>k;
        vi v(n);
        rep(i,n)cin>>v[i];
        sort(all(v),greater<int>());
        int ans=0;
        rep(i,k)ans+=v[i];
        cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

void dfs(int x,int y,int mp[14][14]){

  if(mp[x][y] == '0') return;

  mp[x][y] = 0;
  if(mp[x-1][y] == 1) dfs(x-1,y,mp);
  if(mp[x][y-1] == 1) dfs(x,y-1,mp);
  if(mp[x+1][y] == 1) dfs(x+1,y,mp);
  if(mp[x][y+1] == 1) dfs(x,y+1,mp);
  
}

int main(){
  int i,j,cnt,mp[14][14];
   
  for(i = 0 ; i < 14 ; i++)
    for(j = 0 ; j < 14 ; j++)
      mp[i][j] = 0;


  while(1){ 
    cnt = 0;

    for(i = 1 ; i < 13 ; i++)   
      for(j = 1 ; j < 13 ; j++)
        if(scanf("%1d" ,&mp[i][j]) == EOF) return 0;   

    for(i = 1 ; i < 13 ; i++){   
      for(j = 1 ; j < 13 ; j++){
        
        if(mp[i][j] == 1){
          cnt++;
          dfs(i,j,mp);
        }      

      }
    }  

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

  return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int get_right (int i) {
  while (i >= 10) i /= 10;
  return i;
}

int main() {
  int N; cin >> N;
  long long ans = 0;

  vector< vector<int> > n(10, vector<int>(10));
  for (int i = 1; i <= N; i++) {
    int left = get_right(i);
    int right = i % 10;
    if (!left || !right) continue;
    n[left][right]++;
  }

  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) ans += n[i][j] * n[j][i];
  } 

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    long long a,b,c,d,e,g,h,i,j,k,l,m,n,x,y,z;
cin>>a;
b=a%10;
if(b==2||b==4||b==5||b==7||b==9)
    cout<<"hon"<<endl;
else if(b==3)
    cout<<"bon"<<endl;
else cout<<"pon"<<endl;




}


Measured memory_bytes: 3620
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pll >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll mod = 1e9+7;
const ll inf=1e18+1e17;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}

const ll N =2e5 + 6;


void solve(){
	int n,k;
	cin>>n>>k;
	int arr[n+1];
	memset( arr,0,sizeof ( arr));
	for ( int i=0;i<k;i++){
		int aa;
		cin>>aa;
		for ( int j=0;j<aa;j++){
			int bb;
			cin>>bb;
			arr[bb]++;
		}
	}
	int count=0;
	for ( int i=0;i<=n;i++)
		if ( arr[i]==0)
			count++;
		cout<<count-1<<'\n';
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif	*/
    ll t=1;
	//cin>>t;
    for (ll i=1;i<=t;i++){
    //	cout<<"Case #"<<i<<": ";
    	solve();
 	}
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <numeric>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
#define NUM 1000000007
typedef long long int lli;

bool isAble(int num4, int num2, int numOdd);

int main(){
    int n;
    cin >> n;
    int num4 = 0, num2 = 0, numOdd = 0;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if(x % 4 == 0){
            num4++;
        }else{
            if(x % 2 == 0){
                num2++;
            }else{
                numOdd++;
            }
        }
    }

    string ans = (isAble(num4, num2, numOdd))? "Yes" : "No";
    cout << ans << endl;
    return 0;
}

bool isAble(int num4, int num2, int numOdd){
    if(num2 > 0){
        return (num4 >= numOdd);
    }else{
        return (num4 + 1 >= numOdd);
    }
}

Measured memory_bytes: 256
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = input()

ans = 0
flag = 0
a = 0

for i in range(len(s)):
    if flag != 1:
        if s[i] == "A":
            flag = 1
            a = i
    elif s[i] == "Z":
        ans = i-a+1

print(ans)

Measured memory_bytes: 65412