akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <set>
using namespace std;
using ll = long long;
ll BASE_NUM = 1000000007;

int main()
{
  // 整数の入力
  ll N;
  cin >> N;
  vector<pair<ll,ll>> AB;
  map<ll,ll> unzip_data;
  map<ll,ll> zip_data;
  for (int i = 0; i < N; i++)
  {
    ll a, b;
    scanf("%lld%lld", &a, &b);
    zip_data[a]= 1;
    zip_data[b] = 1;
    AB.push_back({a,b});
  }
  ll i = 0;
  for(auto &p:zip_data){
    p.second = i;
    unzip_data[p.second] = p.first;
    i++;
  }
  sort(AB.begin(),AB.end());
  vector<ll> before_numbers_min(zip_data.size(),0);
  vector<ll> before_numbers_max(zip_data.size(),0);
  for(auto p:AB){
    before_numbers_max[zip_data[p.first]]++;
    before_numbers_min[zip_data[p.second]]++;
  }
  for(int i =1;i < zip_data.size();i++){
    before_numbers_min[i] += before_numbers_min[i-1];
    before_numbers_max[i] += before_numbers_max[i-1];
  }
  // for(auto i: before_numbers_min){
  //   cout << i << ",";
  // }
  // cout << endl;
  // for(auto i: before_numbers_max){
  //   cout << i << ",";
  // }
  // cout << endl;
  ll start_index_min = -1;
  ll end_index_min = -1;
  ll start_index_max = -1;
  ll end_index_max = -1;
  ll start_count = (N+1)/2;
  ll end_count = (N+2)/2;
  for(int i = 0;i < zip_data.size();i++){
    if(start_index_min == -1){
      if(before_numbers_max[i] >= start_count){
        start_index_min = i;
      }
    }
    if(start_index_max == -1){
      if(before_numbers_min[i] >= start_count){
        start_index_max = i;
      }
    }
    if (end_index_max == -1){
      if(before_numbers_min[i] >= end_count){
        end_index_max = i;
      }
    }
    if (end_index_min == -1){
      if(before_numbers_max[i] >= end_count){
        end_index_min = i;
      }
    }
  }

  // cout << start_index_min << start_index_max << endl;
  // cout << end_index_min << end_index_max << endl;
  // cout << unzip_data[start_index] << unzip_data[end_index] << endl;
  if (N % 2 == 0){
    ll max_val = unzip_data[start_index_max] + unzip_data[end_index_max];
    ll min_val = unzip_data[start_index_min] + unzip_data[end_index_min];
    cout << max_val - min_val + 1 << endl;
  }else{
    ll max_val = unzip_data[start_index_max];
    ll min_val = unzip_data[start_index_min];
    cout << max_val - min_val + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 62780
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int num;
    vector<int>vec;
    long long int n,counter=0,counter_1=-1;
    double sum=0;
    cin>>num;
    for(int i=0;i<num;i++)
    {
        cin>>n;
        vec.push_back(n);
    }
    for(int y=1;y<=100;y++)
    {
        for(int p=0;p<vec.size();p++)
        {
            counter+=int(pow((vec[p]-y),2));
        }
        if(counter_1==-1)
            {counter_1=counter;counter=0;}
        else
            {counter_1=min(counter,counter_1);counter=0;}
    }
    cout<<counter_1<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
#ifndef _DEBUG
#define _DEBUG 0
#endif // !_DEBUG
#define IFD if (_DEBUG)
typedef long long ll, i64;
const int N = 2e5 + 60;
ll a[N];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", a + i), a[i] += a[i - 1];
    ll ans = numeric_limits<decltype(ans)>::max();
    for (int i = 2, sp1 = 1, sp2 = 3; i <= n - 2; i++)
    {
        /*for (; sp1 < i; sp1++)
        {
            auto res = {a[sp1] - a[0], a[i] - a[sp1], a[sp2] - a[i], a[n] - a[sp2]};
            ans = min(ans, max(res) - min(res));
            if (a[sp1] - a[0] > a[i] - a[sp1]) break;
        }
        for (; sp2 < n; sp2++)
        {
            auto res = {a[sp1] - a[0], a[i] - a[sp1], a[sp2] - a[i], a[n] - a[sp2]};
            ans = min(ans, max(res) - min(res));
            if (a[sp2] - a[i] > a[n] - a[sp2]) break;
        }
        for (int j = -400; j <= 400; j++)
        {
            int sp3 = max(min(sp1 + j, i - 1), 1);
            int sp4 = max(min(sp2 + j, n - 1), i + 1);
            auto res = {a[sp3] - a[0], a[i] - a[sp3], a[sp4] - a[i], a[n] - a[sp4]};
            //printf("%d %d %d %lld\n", sp3, i, sp4, max(res) - min(res));
            ans = min(ans, max(res) - min(res));
        }*/
        while (sp1 < i && abs((a[sp1] - a[0]) - (a[i] - a[sp1])) >= abs((a[sp1 + 1] - a[0]) - (a[i] - a[sp1 + 1]))) sp1++;
        while (sp2 < n && abs((a[sp2] - a[i]) - (a[n] - a[sp2])) >= abs((a[sp2 + 1] - a[i]) - (a[n] - a[sp2 + 1]))) sp2++;
        auto res = {a[sp1] - a[0], a[i] - a[sp1], a[sp2] - a[i], a[n] - a[sp2]};
        ans = min(ans, max(res) - min(res));
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int dfs(int v, int n, int *visited, int table[n][n]);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);

//main function
int main() {
    int n = iin(), i, max;
    int v[n], c[n];
    REP(i, n) {
        v[i] = iin();
    }
    REP(i, n) {
        c[i] = iin();
    }
    REP(i, n) {
        max += (v[i] > c[i] ? (v[i] - c[i]) : 0);
    }
    iout(max);
    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int dfs(int v, int n, int *visited, int table[n][n]) {
    int all_visited = 1, i;

    REP(i,n) {
        if (!visited[i]) {
            all_visited = 0;
            break;
        }
    }

    if (all_visited) {
        return 1;
    }

    int count = 0;

    REP(i,n) {
        if (!table[v][i]) continue;
        if (visited[i]) continue;

        visited[i] = 1;
        count += dfs(i, n, visited, table);
        visited[i] = 0;
    }

    return count;
}

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

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

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

    return b;
}

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

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

    return b;
}

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 

int N, M, A[201010];
int C[201010];
int L[201010], R[201010];
int non[201010];
//---------------------------------------------------------------------------------------------------
int ans = 0;
void add(int a) {
    if (non[a]) {
        L[a] = R[a] = a;
        if (C[a] == 0) ans--;
        C[a]++;
        non[a] = 0;
    }
    else {
        L[a]--;
        if (0 < L[a]) {
            if (C[L[a]] == 0) ans--;
            C[L[a]]++;
        }
    }
}
void del(int a) {
    if (L[a] == R[a]) {
        if (C[a] == 1) ans++;
        C[a]--;
        non[a] = 1;
    }
    else {
        if (0 < L[a]) {
            if (C[L[a]] == 1) ans++;
            C[L[a]]--;
        }
        L[a]++;
    }
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, N) cin >> A[i];
 
    ans = N;
    rep(i, 0, N + 1) non[i] = 1;
 
    rep(i, 0, N) add(A[i]);
 
    rep(q, 0, M) {
        int x, y; cin >> x >> y;
        x--;
 
        del(A[x]);
 
        A[x] = y;
 
        add(y);
 
        printf("%d\n", ans);
    }
}

Measured memory_bytes: 5376
#include <iostream>
#include <queue>
#include <iomanip>

using namespace std;

priority_queue<int, vector<int>, std::greater<int>> minutes;

int main() {
    int n, hour_in, mimute_in, minute;
    for (int j = 0; j < 2; ++j) {
        cin >> n;
        for (int i = 0; i < n ; ++i) {
            cin >> hour_in >> mimute_in;
            minute =  hour_in * 60 + mimute_in;
            minutes.push(minute);
        }
    }

    int same_check = -1;
    bool is_first = true;
    while(!minutes.empty()) {
        minute = minutes.top();
        if(minute != same_check) {
            if(!is_first) cout <<  " ";
            cout <<  minute / 60 << ":" << setfill('0') << setw(2) <<  minute % 60;
            is_first = false;
            same_check = minute;
        }
        minutes.pop();
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3156
import Data.List
import Control.Monad

dist2 :: [Int] -> [Int] -> Int
dist2 xs ys = sum $  zipWith (\x y -> (x-y)^2) xs ys

isGood :: Int -> Bool
isGood n = (floor x)^2 == n
  where x = sqrt $ fromIntegral n

foo :: [[Int]] -> [[Int]] -> [([Int],[Int])]
foo as bs = do
  a <- as
  b <- bs
  guard (a /= b && isGood (dist2 a b))
  return (a,b)

main = do
  n <- head . map read . words<$> getLine :: IO Int
  ss <- replicateM n getLine :: IO [String]
  let as = map (map read . words) ss :: [[Int]]
  print . (`div` 2) . length $ foo as as



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

int n, m, ans;
string s;

void reans(int i)
{
	if (m > i)
	{
		m = i;
	}
	if (m > ans)
	{
		ans = m;
	}
}

int main()
{
	cin >> n;
	cin >> s;
	for (size_t i = 1; i < n; i++)
	{
		m = 0;
		for (size_t j = 0; i + j < n; j++)
		{
			if (s[j] == s[i + j])
			{
				m++;
				reans(i);
			}
			else
			{
				reans(i);
				m = 0;
			}
		}
	}
	cout << ans << endl;
}

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

#define X first
#define Y second
#define MP make_pair
#define PB push_back
#define ll long long

using namespace std;

int main () {
	
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a!=c){
		cout<<"1";
	}
	else{
		cout<<"0";
	}
	
	return 0;
}

Measured memory_bytes: 256
#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<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#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 INF = 1e9 + 5;
int main(){
    string s;
    cin >> s;
    vs v;
    string a = "";
    int max = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i]=='A' || s[i]=='C' || s[i]=='T' || s[i]=='G'){
            a+=s[i];
        }
        else{
            v.pb(a);
            a = "";
        }
    }
            v.pb(a);


        for(int i = 0; i < v.size(); i++){
            if(v[i].length()>max) max = v[i].length();
        }
        cout << max;
}

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

int main() {
	int k;
	cin >> k;
	int64_t a[k];
	for (auto &i : a) {
		cin >> i;
	}
	reverse(a, a + k);
	int64_t l = 2, r = 2;
	for (auto &i : a) {
		int64_t l_ = (l + i - 1) / i * i;
		int64_t r_ = r / i * i + i - 1;
		if (l_ > r_) {
			cout << -1 << endl;
			return 0;
		}
		l = l_;
		r = r_;
	}
	cout << l << ' ' << r << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 200001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a1,a2,a3,a,b,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,m,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,
q,q1,q2,q3,q4,r,s,t,u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,id4,lim;
map<string,L>Mp;
char str[15];
int main()
{
    c=0;
    scanf("%lld",&n);
    for(L i=0;i<n;i++){
        scanf("%s",str);
        Mp[string(str)]++;
        if(Mp[string(str)]==1)c++;
    }
    printf("%lld\n",c);
    return 0;
}

/// empty() lld lld push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 19328
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




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

int n;
cin >> n;

vector<int> v(n);
rep(i,n){
    int a;
    cin >> a;
    v[a-1] = i;
}

rep(i,n) cout << v[i]+1 << ' ';
cout << endl;

return 0;
}

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}


struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      long a, b, c; scan(a, b, c);
      long res = std::min(std::min(a+b, b+c), c+a);
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define dF2(i,a,b) for(int i=a;i>(b);--i)
#define eF(i,u) for(int i=h[u];i;i=nxt[i])
#define ll long long
#define ld double
using namespace std;
typedef pair<int,int> pii;
inline int Gcd(int X,int Y){return Y?Gcd(Y,X%Y):X;}
inline ll Gcd(ll X,ll Y){return Y?Gcd(Y,X%Y):X;}
inline int Pow(int base,ll exp,int _mod){int _ans=1;for(;exp;exp>>=1,base=(ll)base*base%_mod)exp&1?_ans=(ll)_ans*base%_mod:0;return _ans;}
inline ll Pow(ll base,ll exp,ll _mod){ll _ans=1;for(;exp;exp>>=1,base=base*base%_mod)exp&1?_ans=_ans*base%_mod:0;return _ans;}
const int INF=0x3f3f3f3f;

int n;
ll l=2,r=3;
ll a[100001];

int main(){
	scanf("%d",&n);
	F(i,1,n) scanf("%lld",a+i);
	dF(i,n,1){
		l=((l-1)/a[i]+1)*a[i];
		r=((r-1)/a[i]+1)*a[i];
		if(l>=r) {puts("-1"); return 0;}
	}
	printf("%lld %lld",l,r-1);
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
			String str = sc.next();
			char[] str_array = new char[20];
				for(int i = 0; i < str.length(); i++)
				{
					str_array[i] = str.charAt(i);
				}
				for(int i = 0; i < str.length(); i++)
				{
					System.out.print(str_array[str.length()-i-1]);
				}
					System.out.println();
	}
}

Measured memory_bytes: 17120
# -*- coding: utf-8 -*-
import numpy as np

def get_gcd(a, b, c):
    min_ab = min(a, b)
    max_ab = max(a, b)
    amari = max_ab % min_ab
    if amari == 0:
        gcd1 = min_ab
    else:
        x = min_ab
        y = amari
        while y != 0:
            amari = x % y
            if amari == 0:
                gcd1 = y
                break
            x = y
            y = amari
    min_2 = min(c, gcd1)
    max_2 = max(c, gcd1)
    amari = max_2 % min_2
    if amari == 0:
        gcd2 = min_2
    else:
        x = min_2
        y = amari
        while y != 0:
            amari = x % y
            if amari == 0:
                gcd2 = y
                break
            x = y
            y = amari

    return gcd2


k = int(input())
ans = 0

for a in range(1, k+1):
    for b in range(a+1, k+1):
        if b == a:
            continue
        for c in range(b+1, k+1):
            if c == a or c == b:
                continue
            ans += get_gcd(a, b, c) * 6

for a in range(1, k+1):
    b = a
    for c in range(1, k+1):
        if c == a:
            continue
        ans += get_gcd(a, b, c) * 3

for a in range(1, k+1):
    b = a
    c = a
    ans += get_gcd(a, b, c)

print(ans)

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


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

  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> suma(n+1);
  vector<ll> sumb(m+1);
  suma[0] = sumb[0] = 0;
  rep(i,n){
    ll a;
    cin >> a;
    suma[i+1] = suma[i] + a;
  }
  rep(i,m){
    ll b;
    cin >> b;
    sumb[i+1] = sumb[i] + b;
  }
  ll ans = 0;
  rep(i,n+1){
    if(suma[i]>k) break;
    ll tans = i;
    tans += upper_bound(sumb.begin(),sumb.end(),k-suma[i]) - sumb.begin() -1;
    ans = max(ans,tans);
  }
  cout << ans << endl;
  return 0;
    

}


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n, m;
	cin >> n >> m;
	cout << (n * (n - 1) / 2) + (m * (m - 1) / 2) << "\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		  Scanner sc = new Scanner(System.in);
	        int a = sc.nextInt();
	        String s = sc.next();
		
	        if(a>=3200) {
	        	System.out.println(s);
	        	
	        }
	        else
	        {
	        	System.out.println("red");
	        }
	        
	}



}

Measured memory_bytes: 21588
#include<stdio.h>
int gcd(int x,int y);

int main()
{
  int a,b;
  int gcd_n;
  scanf("%d %d",&a,&b);
  gcd_n = gcd(a,b);
  printf("%d\n",gcd_n);

  return 0;
}

int gcd(int x,int y)
{
int tmp;
  
  while (y)
    {
      tmp = x % y;
      x = y;
      y = tmp;
    }
  
  return x;
}

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

int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int64_t A, B, C;
    int K;
    cin >> A >> B >> C >> K;
    int64_t M = max(A, max(B, C));
    cout <<  (M << K) + (A + B + C - M) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int max(int a, int b, int c){
  int ans;
  ans = a;
  if(ans < b){
    ans = b;
  }
  if(ans < c){
    ans = c;
  }
  return ans;
}

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

Measured memory_bytes: 128
from sys import stdin
import collections
def main():
    n = int(stdin.readline().rstrip())
    D = [int(i) for i in input().split()]
    hash = collections.Counter(D)
    count = hash[0]
    if(count != 1 or D[0] != 0):
        print(0)
        return
    for i in range(1, max(D)+1):
        count *= hash[i-1] ** hash[i]
    print(count%998244353)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 19936
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define N 100007
#define INF 1000000000
using namespace std;

typedef long long ll;

int main()
{
    int n, k;
    ll t, d;
    vector<pair<ll, ll> > v;
    vector<int> memo(N, 0); //食べたネタの種類をめも
    cin >> n >> k;
    FOR(i, 0, n)
    {
        cin >> t >> d;
        v.push_back(MP(d, t));
    }

    sort(v.begin(), v.end(), greater<pair<ll, ll> >());

    ll sum = 0, ctr = 0;
    FOR(i, 0, k)
    {
        sum += v[i].first;
        if (memo[v[i].second] == 0)
            ctr++;
        memo[v[i].second]++;
    }
    ll res = sum + ctr * ctr;

    mFOR(i, k - 1, -1) //複数個食べていて，かつ，最も美味しさが小さいものを探す
    {
        if (memo[v[i].second] > 1)
        {
            FOR(j, k, n)
            {
                if (memo[v[j].second] == 0)
                {
                    sum += (v[j].first - v[i].first);
                    memo[v[i].second]--;
                    memo[v[j].second]++;
                    ctr++;
                    res = max(res, sum + ctr * ctr);
                    break;
                }
            }
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2804
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;

int go(int p, int n, int s) {
	if (n == 0 && s == 0) return 1;
	if (s < 0) return 0;
	int res = 0;
	REP (i, p + 1, 9) res += go(i, n - 1, s - i);
	return res;
}

int main() {
	for (int n, s; cin >> n >> s, (n | s) != 0; ) {
		cout << go(-1, n, s) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void)
{
	int i,j[10000],k;
	scanf("%d",&i);
	for(k=0;k<i;k++)
	{
		scanf(" %d",&j[k]);
	}
	for(k=0;k<i;k++)
	{
	    if(k)
			printf(" ");
		printf("%d",j[i-k-1]);
		}
		printf("\n");
	return 0;
}
	

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

typedef pair<long long, long long> ii;

int N;
long long A[200005];
long long B[200005];

/*
1 6
2 5
3 9
8 12
*/

ii cntAtLeast(long long k){
    long long ans1 = 0;
    long long ans2 = 0;
    for(int i = 0; i < N; i ++){
        if(k >= B[i]){ans1 ++;}
        if(k >= A[i]){ans2 ++;}
    }

    return ii(ans1, ans2);
}

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

    for(int i = 0; i < N; i ++){
        scanf("%lld%lld", &A[i], &B[i]);
    }

    long long lo = 0;
    long long hi = 1000000000;
    while(lo < hi){
        long long temp = (lo+hi)>>1;
        if(cntAtLeast(temp).second >= (N+1)/2){
            hi = temp;
        }else{
            lo = temp+1;
        }
    }

    long long loMedian = lo;

    lo = 0;
    hi = 1000000000;
    while(lo < hi){
        long long temp = (lo+hi)>>1;
        if(cntAtLeast(temp).first >= (N+2)/2){
            hi = temp;
        }else{
            lo = temp+1;
        }
    }

    long long hiMedian = lo;

    //printf("debug: %lld %lld\n", loMedian, hiMedian);

    if(N%2 == 1){
        printf("%lld", hiMedian-loMedian+1);
        return 0;
    }else{
        long long ans = hiMedian-loMedian+1;

        long long lo = 0;
        long long hi = 1000000000;
        while(lo < hi){
            long long temp = (lo+hi)>>1;
            if(cntAtLeast(temp).second >= (N+2)/2){
                hi = temp;
            }else{
                lo = temp+1;
            }
        }

        long long loMedian2 = lo;

        lo = 0;
        hi = 1000000000;
        while(lo < hi){
            long long temp = (lo+hi)>>1;
            if(cntAtLeast(temp).first >= (N+1)/2){
                hi = temp;
            }else{
                lo = temp+1;
            }
        }

        long long hiMedian2 = lo;

        //printf("debug2: %lld %lld\n", loMedian2, hiMedian2);

        loMedian *= 2;
        loMedian2 *= 2;
        hiMedian *= 2;
        hiMedian2 *= 2;

        long long finalLoMedian = (loMedian+loMedian2)/2;
        long long finalHiMedian = (hiMedian+hiMedian2)/2;

        printf("%lld\n", finalHiMedian-finalLoMedian+1);
        return 0;
    }
    return 0;
}


Measured memory_bytes: 6920
package main
import(
  "fmt"
  "bufio"
  "os"
  "strconv"
)
var sc=bufio.NewScanner(os.Stdin)
func nextInt() int{
  sc.Scan()
  i, e :=strconv.Atoi(sc.Text())
  if e!=nil{
    panic(e)
  }
  return i
}
func main(){
  var i int
  sc.Split(bufio.ScanWords)
  n:=nextInt()
  a:=make([]int, n)
  for i=0;i<n;i++{
    a[i]=nextInt()
  }
  ans:=0
  l:
  for{
    for i=0;i<n;i++{
      if a[i]%2==0{
        a[i]/=2
      }else{
        break l
      }
    }
    ans++
  }
  fmt.Println(ans)
}


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

const int MAXN = 1000 * 100 + 10;

int n;
pair <int, int> b[MAXN];
long long ans;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> b[i].first;
        b[i].second = i;
    }
    sort(b, b + n) ;

	for (int i = 0; i < n; i += 2)
        if (b[i].second % 2 != i % 2)
            ans++;
	
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
  int e=0,w=0,s=0,n=0;
  cin >> S;
  for (int i=0;i<S.size();i++){
    if(S[i]=='N')n++;
    if(S[i]=='S')s++;
    if(S[i]=='E')e++;
    if(S[i]=='W')w++;
  }
  if (n==s && e==w)cout << "Yes" <<endl;
  else if ((n==0 && s==0 && e>0 && w>0) || (e==0 && w==0 && n>0 && s>0))cout << "Yes" <<endl;
  else cout << "No" <<endl;
}


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

using namespace std;

#define PB push_back
#define f first
#define s second

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

const int MOD = 1000000007;
const int INF = 1000000007;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0)
    {
        c -= b;
        if(c <= 0)
        {
            cout << "Yes\n";
            return 0;
        }
        a -= d;
    }
    if(a > 0)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3640
x,n = gets.split.map(&:to_i)
y = x
if n > 0
    P = gets.split.map(&:to_i).sort
    if P.include?(x)
        a = [*1..250].map{|c|c-100} - P
        m = -10000
        a.each do |b|
            m = b if (x-m).abs > (x-b).abs
        end
        y = m
    end
end
puts y

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    double l;cin>>l;
    double a=l/3;
    cout<<fixed<<setprecision(10)<<a*a*a<<endl;
}

Measured memory_bytes: 256
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
#include<limits>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
  int a[3][3];
  bool seat[3][3];
  int n;
  rep(i,3){
    rep(j,3){
      cin>>a[i][j];
      seat[i][j]=false;
    }
  }
  cin>>n;
  VI b(n);
  rep(i,n){
    cin>>b[i];

    rep(j,3){
      rep(k,3){
        if(b[i]==a[j][k]) seat[j][k]=true;
      }
    }
  }

  bool flag=true;
  rep(i,3){
    flag=true;
    rep(j,3){
      if(seat[i][j]==false){
      flag=false;
      }
    }
    if(flag){
      cout<<"Yes"<<endl;
      return 0;
    }
  }

  rep(i,3){
    flag=true;
    rep(j,3){
      if(seat[j][i]==false){
      flag=false;
      }
    }
    if(flag){
      cout<<"Yes"<<endl;
      return 0;
    }
  }

  flag=true;
  rep(i,3){
    if(seat[i][i]==false) flag=false; 
  }
  if(flag){
      cout<<"Yes"<<endl;
      return 0;
  }

  flag=true;
  for(int i=0;i<3;i++){
    if(seat[i][2-i]==false) flag=false;
  }
  if(flag){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b,c,d = 0,e = 0;
	while(scanf("%d,%d,%d",&a,&b,&c) != EOF){
		if(a * a + b * b == c * c) d++;
		if(a == b) e++;
	}
	printf("%d\n%d\n",d,e);
	return 0;
}

Measured memory_bytes: 1020
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifdef HOME
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef gp_hash_table < int, int > fast;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 1e5 + 5, M = 1e3 + 5, LG = 20;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1 / db(1e6);
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

void test() {
    ll n;
    cin >> n;
    cout << ll(pow(n, 3)) << "\n";
}

int main() {
    fast_io();
    #ifdef HOME
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cout << fixed << setprecision(15);
    test();
    #ifdef HOME
        cout << "Time: " << (int)(clock() * 1000. / CLOCKS_PER_SEC) << "ms";
    #endif
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
inline int add(int x,int y) {return (x+y>=mod) ? (x+y-mod) : (x+y);}
inline int dec(int x,int y) {return (x-y<0) ? (x-y+mod) : (x-y);}
inline int mul(int x,int y) {return (long long)x*y%mod;}
inline int power(int a,int b,int rs=1) {for(;b;b>>=1,a=mul(a,a)) if(b&1) rs=mul(rs,a); return rs;}
inline int cinv(int a) {return power(a,mod-2);}

const int N=1e6+50;
struct combin {
	int fac[N],ifac[N];
	combin() {
		fac[0]=1;
		for(int i=1;i<N;i++) fac[i]=mul(fac[i-1],i);
		ifac[N-1]=cinv(fac[N-1]);
		for(int i=N-2;~i;i--) ifac[i]=mul(ifac[i+1],i+1);
	}
	inline int C(int a,int b) {
		if(a>=0 && b>=0 && a>=b) return mul(fac[a],mul(ifac[b],ifac[a-b]));
		else return 0;
	}
} C;

int n,m,k,pw[N],ans;
int l,r=-1,now=-1,sum;
inline void trans() {
	++now;
	if(l>r) return;
	sum=mul(sum,2);
	sum=dec(sum,C.C(now-1,r));
	sum=add(sum,C.C(now-1,l-1));
}
inline void move(int L,int R) {
	while(l<L) sum=dec(sum,C.C(now,l)), ++l;
	while(l>L) --l, sum=add(sum,C.C(now,l));
	while(r>R) sum=dec(sum,C.C(now,r)), --r;
	while(r<R) ++r, sum=add(sum,C.C(now,r));
}
int main() {
	cin>>n>>m>>k;
	pw[0]=1;
	for(int i=1;i<=n+m+k;++i) pw[i]=mul(pw[i-1],3);
	for(int len=n;len<=n+m+k;++len) {
		trans(); move(max(0,len-n-k),min(m,len-n));
		int t=mul(sum,C.C(len-1,n-1));
		t=mul(t,pw[n+m+k-len]);
		ans=add(ans,t);
	} cout<<ans<<'\n';
}

Measured memory_bytes: 11904
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int m,d,ans=0;
  cin >> m >> d;
  if(m<4||d<=9) {
    cout << 0 << endl;
    return 0;
  }
  for(int i=4; i<=m; i++) {
    for(int j=10; j<=d; j++) {
      int d1,d2;
      d1=j/10,d2=j%10;
      if(i==d1*d2&&(d1>=2&&d2>=2)) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
ans=sum(b)
pre=0
for i in range(n):
    tabeta=a[i]
    if tabeta==pre+1 and i!=0:
        ans+=c[pre-1]
    pre=tabeta
print(ans)

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 2e5+5;

ll n , a[N] , k , sz , st , en ,lvl[N];
bool vis[N] , inS[N];

void ans(int node)
{
    cout << node << '\n';
    exit(0);
}

void dfs(int node)
{
    vis[node]=1 , inS[node]=1 ,  k--;
    if (!k) ans(node);

    int ch = a[node];
    if (!vis[ch])
    {
        lvl[ch] = lvl[node]+1;
        dfs(ch);
    }
    else if (inS[ch])
    {
        sz = lvl[node] - lvl[ch] + 1;
        st = ch , en = node;
        return;
    }
    inS[node] = 0;
}

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

    cin >> n >> k;

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

    k++;
    dfs(1);

    ll tmp = k/sz;
    k -= tmp*sz;
    if (!k) ans(en);

    memset(vis , 0 , sizeof(vis));
    memset(inS , 0 , sizeof(inS));
    dfs(st);

    return 0;
}

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

using namespace std;

const int M = 26;
const int N = 200005;

char s[N];
int cnt[M];

int main() {
  scanf("%s", s + 1);
  long long res = 1;
  int sum = 0;
  for (int i = 1; s[i] != '\0'; ++i) {
    res += 1LL * (sum - cnt[s[i] - 'a']);
    ++cnt[s[i] - 'a'];
    sum += 1;
  }
  cout << res << endl;
  return 0;
}


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

const int maxn=2e5+3;
char pie[maxn];
int len;
long long ans,wt;

int main() {
	
	scanf("%s",pie);
	len=strlen(pie);
	for(register int i=len-1;i>=0;--i)
	if(pie[i]=='W') ++wt;
	else ans+=wt;
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
N, K = [int(x) for x in input().split(' ')]

candidates = set(range(1,N+1))
#print(candidates)
for k in range(K):
  input()
  D = set(int(x) for x in input().split(' '))
  candidates -= D
  #print('D',D)
  #print(candidates)

print(len(candidates))
         

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int x,a,b; cin>>x>>a>>b;
	int y=abs(x-a), z=abs(x-b);
	if (y<z) cout<<"A";
	else cout<<"B"<<endl;
	return 0;
}


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

using namespace std;

long long power(int n)
{
    long long ans=1,result=10;

    while(n)
    {
        if(n%2)
            ans=ans*result;

        result=result*result;
        n=n/2;
        ans=ans%1000000007;
        result=result%1000000007;
    }

    return ans;
}

int main()
{
    long long a,b,c,d;
    cin>>a>>b>>c>>d;

    cout<<max(a*c,max(a*d,max(b*c,b*d)));
    return 0;
}


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

int main()
{
    int x,t;
    while(~scanf("%d %d",&x,&t))
    {
        if(x<t)
        {
            printf("0\n");
            continue;
        }
        else
        {
            printf("%d\n",x-t);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int h, w;
    cin >> h >> w;

    h = n - h + 1;
    w = n - w + 1;
    cout << h * w << '\n';

    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n: u32 = read();

    let mut target_array: Vec<u32> = (0..n).map(|_| read::<u32>()).collect();

    let mut flag = true;
    let mut count = 0;

    while flag {
        flag = false;
        for j in (1..n).rev() {
            if target_array[j as usize] < target_array[(j - 1) as usize] {
                let temp = target_array[j as usize];
                target_array[j as usize] = target_array[(j - 1) as usize];
                target_array[(j - 1) as usize] = temp;
                flag = true;
                count += 1;
            }
        }
    }

    for index in 0..n {
        if index != n - 1 {
            print!("{} ", target_array[index as usize]);
        } else {
            print!("{}", target_array[index as usize]);
        }
    }
    println!("");
    println!("{}", count);
}



Measured memory_bytes: 5024
#include<stdio.h>
  
int main(){
  
int a,b,max=-2000000000,min;
  
scanf("%d",&a);
  
int r[200000];
  
int i;
 
for(i=0;i<a;i++)scanf("%d",&r[i]);
  
min=r[0];
  
 
  
for(i=1;i<a;i++){
  
if(r[i]-min>max)max=r[i]-min;
if(min>r[i])min=r[i];
}
  
printf("%d\n",max);
  
return 0;
}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'

long double n, x, ans = 0;
string s;

int main()
{
	IOS;
	cin >> n;
	while (n--) {
		cin >> x >> s;
		if (s == "JPY")
			ans += x;
		else
			ans += (x * 380000.00);
	}
	cout << ans << endl;
	return 0;
}



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

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

    cout<<arr[0];
    for(int i=1; i<n; i++){
        cout<<" "<<arr[i];
        }
        cout<<endl;

    for(int i=1; i<n; i++){
        temp=arr[i];
        int j=i-1;
        while((temp<arr[j]) && (j>=0)){
            arr[j+1]=arr[j];
            j--;
        }
        arr[j+1]=temp;

        cout<<arr[0];
        for(int i=1; i<n; i++){
        cout<<" "<<arr[i];
        }
        cout<<endl;
    }

    return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

mat G(500010, vec(0));
vec a(500010, -1);

ll dfs(ll v){
    ll res = 0;
    for(ll to : G[v]){
        res = max(res, dfs(to) + 1);
    }
    a[v] = res;
    return res;
}
int main() {
    cin>>S;
    N = S.size();
    vector<bool> top(N + 1, true);
    rep(i,N){
        if(S[i] == '<'){
            G[i + 1].push_back(i);
            top[i] = false;
        }else{
            G[i].push_back(i + 1);
            top[i + 1] = false;
        }
    }
    rep(i, N + 1){
        if(top[i]) dfs(i);
    }
    ll sum = 0;
    rep(i, N + 1) sum += a[i];
    cout<<sum<<endl;
}

Measured memory_bytes: 55428
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int ok[122222];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	ok[0]=1;
	fo(i,1,111111) fo(j,100,106) if(j<=i) if(ok[i-j])ok[i]=1;
	int x;
	cin>>x;
	cout<<ok[x]<<endl;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main() {
  int n, sum = 0;
  scanf("%d", &n);
  int v[n], c[n];
  for(int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  
  for(int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
  }
  
  for(int i = 0; i < n; i++) {
    if(v[i] - c[i] > 0) {
      sum += v[i] - c[i];
    }
  }
  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int ddx[6]={0,1,0,-1,1,-1},ddy[6]={-1,0,1,0,1,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int t[20][20];
int dp[1<<16];

int main(){
	while(1){
		cin>>n;
		if(n==0)break;
		REP(i,1<<16)dp[i]=1e8;
		for(int i=1;i<=n;i++){
			for(int j=0;j<=n;j++){
				cin>>t[i][j];
			}
		}
		dp[0]=0;
		for(int i=0;i<(1<<n);i++){
			for(int j=0;j<n;j++){
				if(!(i>>j&1)){
					int cos=t[j+1][0];
					for(int k=1;k<=n;k++){
						if(i>>(k-1)&1){
							cos=min(cos,t[j+1][k]);
						}
					}
					dp[i|(1<<j)]=min(dp[i|(1<<j)],dp[i]+cos);
					//cout<<dp[i|(1<<j)]<<endl;
				}else{
					//cout<<"skip"<<endl;
				}
			}
		}
		cout<<dp[(1<<n)-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3344
from itertools import combinations

n = int(input())
s = [input() for _ in range(n)]

cnt = dict({'M': 0, 'A': 0, 'R': 0, 'C': 0, 'H': 0})
for name in s:
    if name[0] in cnt:
        cnt[name[0]] += 1

ans = 0
for i, j, k in combinations(cnt,3):
    ans += cnt[i] * cnt[j] * cnt[k]
print(ans)


Measured memory_bytes: 9900
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int X;
	cin >> X;

	int i = 1;
	int s = 0;
	while (s < X) {
		s += i;
		i++;
	}
	i--;

	cout << i << endl;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
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;
    }
	return 0;
}


Measured memory_bytes: 256