akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in1(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in1(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int D;
    in1(D);

    if (D == 25)
    {
        outl("Christmas");
    }
    else if (D == 24)
    {
        outl("Christmas Eve");
    }else if(D == 23)
    {
        outl("Christmas Eve Eve");
    }else if (D == 22)
    {
        outl("Christmas Eve Eve Eve");
    }

    return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007

int main(){
    char a,b;
    cin >> a >> b;
    if(a==b) cout << 'H' << endl;
    else cout << 'D' << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<cassert>
#include<stack>
#include<fstream>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
ll f(ll x,ll p){//p%がx円である最小の値段
	//ans*p/100>=x
	return (x*100+p-1)/p;
}
ll g(ll x,ll p){//x円のp%はいくつか
	return x*p/100;
}
int main(){
	ll a,b;
	cin>>a>>b;
	ll ans=max(f(a,8),f(b,10));
	if(g(ans,8)==a&&g(ans,10)==b){
		cout<<ans<<endl;
	}
	else cout<<-1<<endl;
}


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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    double L;
    cin >> L;


    double ans = 0;
    double a = L/3.0;
    for(double i = 0;i < 1000;i += 0.001){
        double temp = (a*a - i*i)*a;
        ans = max(ans,temp);
    }

    cout << fixed << setprecision(7) << ans << endl;
    return 0;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int dp[2001][2001][2]={};

int main()
{
    int m,n;
    string s,t;
    cin >>m >>n >>s >>t;

    rep(i,m+1)rep(j,n+1)
    {
        if(i<m)
        {
            if(s[i]=='I')
            {
                dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][1]+1);
            }
            else
            {
                if(dp[i][j][0]>0) dp[i+1][j][1] = max(dp[i+1][j][1], dp[i][j][0]+1);
            }
        }

        if(j<n)
        {
            if(t[j]=='I')
            {
                dp[i][j+1][0] = max(dp[i][j+1][0], dp[i][j][1]+1);
            }
            else
            {
                if(dp[i][j][0]>0) dp[i][j+1][1] = max(dp[i][j+1][1], dp[i][j][0]+1);
            }
        }
    }

    int ans=0;
    rep(i,m+1)rep(j,n+1) ans = max(ans,dp[i][j][0]);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 34580
#include<bits/stdc++.h>
#define clr(x) memset(x, 0, sizeof(x))
#define sz(x) (int)x.size()

using namespace std;

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

const ll mx = 105;
const ll maxn = 1000001;
const ll mod = 1000000007;

vector<vector<int>> adj;
vector<int> res;
vector<int> ord;


int main(){

   ios_base::sync_with_stdio(false);
   cin.tie(0);
   
    ll n, i ,j , k;
    
    string s;

    cin>>s;

    int res = 0;

    if(s[2] == s[3] && s[4] == s[5]){
        res = 1;

    }

    cout<<(res == 1?"Yes":"No")<<"\n";

}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main(){
	
	ll a, b;
	while(cin >> a >> b){
		ll tmp = __gcd(a, b);
		cout << tmp << " " << a * b / tmp << endl;
	}

	return 0;
}

Measured memory_bytes: 3084
import sys
import math

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B = lr()
answer = -1
for x in range(1001):
    if math.floor(x * 0.08) == A and math.floor(x * 0.1) == B:
        answer = x
        break

print(answer)


Measured memory_bytes: 3060
K, A, B = map(int, input().split())

if B-A < 2:
    print(K+1)
else:
    if K > A:
        ans = A
        K -= A-1
        if K % 2 == 0:
            ans += K//2*(B-A)
        else:
            ans += K//2*(B-A)
            ans += 1
    else:
        ans = K+1
    print(ans)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
  
struct node{
  struct node *l;
  struct node *r;
  struct node *p;
  int key;
};

typedef struct node * Node;

Node root;

void insert(int);
Node Search(Node ,int );
void Preorder(Node );
void Inorder(Node );

main()
{
  int n, i, x;
  char str[20];
  Node s;
  scanf("%d",&n);
  
  for(i=0; i<n; i++){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d", &x);
      insert(x);
    }
    else if(str[0]=='f'){
      scanf("%d", &x);
      s = Search(root,x);
      if(s!= NIL ) printf("yes\n");
      else printf("no\n");
    }
    else if (str[0]=='p'){
      Inorder(root);
      printf("\n"); 
	  Preorder(root);
	  printf("\n");
	}
  }
  return 0;
}


void insert(int k)
{
  Node y=NIL;
  Node x=root;
  Node z;
  
  z = malloc(sizeof(struct node));
  z->key=k;
  z->l=NIL;
  z->r=NIL;
  
  while(x!=NIL){
    y=x;	
	if(z->key<x->key) x=x->l;
    else x=x->r;
  }
  z->p=y;
  
  if(y==NIL) root=z;
  else if(z->key<y->key) y->l=z;
  else y->r=z;
}


Node Search(Node t,int k)
{
  if(t==NIL || k==t->key) return t;
  if(k<t->key) return Search(t->l,k);
  else return Search(t->r,k);
}


void Preorder(Node t)
{
  printf(" %d",t->key);
  if(t!=NIL){
    if(t->l!=NIL) Preorder(t->l);
    if(t->r!=NIL) Preorder(t->r);
  }
}
  

void Inorder(Node t)
{  
  if(t!=NIL){
    if(t->l != NIL){
      Inorder(t->l);
	}
    printf(" %d", t->key);	
    if(t->r!=NIL){
      Inorder(t->r);
	}
  }
}

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

using ll = long long;

int main() {
    int N, ans = 0, j = 1;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    rep(i, N) {
        if (a[i] == j) {
            j++;
        } else {
            ans++;
        }
    }
    if (ans == N) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 1024
from  itertools import combinations as cmb
import copy 

H,W,K = map(int,input().split())

C = []
ans = 0

for i in range(H):
  C.append(list(input()))

for i in range(H):#選ぶ列数
  for j in range(W):#選ぶ行数
    for hs in cmb(range(H),i):#選ぶ列数の組み合わせ
      for ws in cmb(range(W),j):#選ぶ行数の組み合わせ
        tmpC = copy.deepcopy(C)#操作用配列
        for h in hs:
          tmpC[h] = ["" for k in range(W)]#その列を消す
        for w in ws:
          for k in range(H):
            tmpC[k][w]="" #その行を消す
        #print(tmpC,hs,ws,sum(tmpC,[]).count("#")==K)
        if sum(tmpC,[]).count("#")==K:
          ans +=1    
print(ans)

Measured memory_bytes: 78188
def get_needed_problems(bini_str):
  point = 0
  cnt = 0

  for i in range(D):
    if bini_str[i] == '1':
      cnt += PC[i][0]
      point += PC[i][0]*(i+1)*100 +PC[i][1]
  if point>=G:
    return cnt
  
  for i in range(D-1,-1,-1):
    if bini_str[i] == '0':
      for j in range(1,PC[i][0]):
        cnt += 1
        point += (i+1)*100
        if point>=G:
          return cnt
  return -1 

D,G = map(int,input().split())
PC = [list(map(int,input().split())) for _ in range(D)]

ans = float('inf')
for i in range(2**D):
  bini_str = bin(i)[2:].zfill(D)
  res = get_needed_problems(bini_str)
  if res != -1:
    ans = min(ans,res)
print(ans)

Measured memory_bytes: 42736
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		String word_before = sc.next();
		//int N = sc.nextInt();
      	//String word_arr[] = new String[N];
		String word_after = word_before.replaceAll("[0-9a-z]", "x");
		System.out.println(word_after);
      	
    }
		
}

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

using namespace std;
constexpr uint64_t MOD = 1e9+7;

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

	uint64_t inversions = 0;

	for (int i = 0; i < n; ++i){
		for (int j = i + 1; j < n; ++j){
			if (A[i] > A[j]){
				inversions += (k * (k + 1)) / 2;
				inversions %= MOD;
			} else if (A[j] > A[i]){
				inversions += (k * (k - 1)) / 2;
				inversions %= MOD;
			}
		}
	}

	cout << inversions % MOD;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int n;
int f(int b,int c){
  return c*((n-1)/b+1);
}
int main(void){
  int n,i,a[4],b[4];
  while(1){
    scanf("%d",&n);
    if(n<1)return 0;
    if(n%1111<1){
      PRS("NA");
      continue;
    }
    for(i=0;n!=6174;i++){
      FORJ(4){
        a[j]=b[j]=n%10;
        n/=10;
      }
      qsort(a,4,sizeof(int),d);
      qsort(b,4,sizeof(int),u);
      int x=0,y=0;
      FORJ(4){
        x*=10;
        x+=a[j];
        y*=10;
        y+=b[j];
      }
      n=x-y;
    }
    PRN(i);
  }
  return 0;
}



Measured memory_bytes: 2048
#include <algorithm>//min/max/sort(rand-access it)/merge
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific

using namespace std;

typedef unsigned long long ull;

int main(void) {
    int n;
    cin >> n;
    ull t, a;
    ull t_prev, a_prev;
    cin >> t >> a;
    for (int i = 1; i < n; ++i)
    {
        ull m_t, m_a, m;
        t_prev = t;
        a_prev = a;
        cin >> t >> a;
        if (t >= t_prev && a >= a_prev) {
            continue;
        } else {
            m_t = t_prev / t + (t_prev % t ? 1 : 0);
            m_a = a_prev / a + (a_prev % a ? 1 : 0);
            m = max(m_t, m_a);
            t *= m;
            a *= m;
        }
    }
    cout << (a + t) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	char s[100];
	scanf("%s", &s);
	if (s[0] == s[1] && s[0] != s[2] && s[2] == s[3]) puts("Yes");
	else if (s[0] == s[2] && s[0] != s[1] && s[1] == s[3]) puts("Yes");
	else if (s[0] == s[3] && s[0] != s[1] && s[1] == s[2]) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	string s;
	cin>>s;
	if(s[5]==s[4]&&s[2]==s[3])
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}


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

using namespace std;

const int maxn = 2003;

int n, m;

long long fast_pow(long long num, int deg)
{
    long long ans = 1, pow = num;
    while (deg)
    {
        if (deg & 1)
            ans = ans * pow % m;

        deg >>= 1;

        pow = pow * pow % m;
    }

    return ans;
}

long long add(long long a, long long b)
{
    a += b;
    if (a >= m)
        a -= m;

    return a;
}

void read()
{
    cin >> n >> m;
}

long long dp[maxn * 3][maxn * 6];
void solve()
{
    dp[0][3*n+1] = 1;
    for (int i = 1; i <= 3 * n; i++)
    {
        auto to_mult = fast_pow(i, m-2);
        for (int j = -3 * n; j <= 3 * n; j++)
        {
            dp[i][j+3*n+1] = add(dp[i][j+3*n+1], dp[i-1][j-1+3*n+1]);
            if (i >= 2)
                dp[i][j+3*n+1] = add(dp[i][j+3*n+1], dp[i-2][j+1+3*n+1]);

            if (i >= 3)
                dp[i][j+3*n+1] = add(dp[i][j+3*n+1], dp[i-3][j+3*n+1]);

            dp[i][j+3*n+1] = dp[i][j+3*n+1] * to_mult % m;
        }
    }

    long long ans = 0;
    for (int j = 0; j <= 3 * n; j++)
        ans = add(ans, dp[3 * n][j+3*n+1]);

    for (int i = 1; i <= 3 * n; i++)
        ans = ans * i % m;

    cout << ans << endl;
}

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

    read();
    solve();
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, N;
string s, t, d, c;


// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> k ;
	vll pos,neg;
	bool zero = false;
	for(ll i=0;i<n;i++) {
		cin>>x;
		if(x == 0) zero = true;
		if(x > 0) pos.pb(x);
		if(x < 0) neg.pb(x);
	}
	reverse(all(neg));

	//for(ll i=1;i<pos.size();i++) pos[i]+=pos[i-1];
	//for(ll i=1;i<neg.size();i++) neg[i]+=neg[i-1];
	for(ll i=0;i<neg.size();i++) neg[i]=-neg[i];

	k-=zero;
	
	ll ans = INT_MAX;
	ll i=k,j=0;
	while(i>=0) {
		if(neg.size() >= i && pos.size() >= j) {
			ll val = ((i)?neg[i-1]:0) + ((j)?pos[j-1]:0);
			//cout<<i<<" "<<j<<" "<<val;newl;
			if(i && j) val += min(neg[i-1],pos[j-1]);
			//cout<<i<<" "<<j<<" "<<val;newl;
			ans = min(ans, val);

		}
		i--;
		j++;
	}	
	cout<<ans;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 4420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using iii = pair<ii, ll>;
#define vt vector
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
const ll MOD = 1e9 + 7;
const ll INF = 2e9;
// const ll N = ;

ll n, maxim, ans;

void solve() {
    cin >> n;
    for(ll i = 1, x; i <= n; i++) {
        cin >> x;
        if(x >= maxim) maxim = x;
        else ans += maxim - x;
    }
    cout << ans << "\n";
}

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

Measured memory_bytes: 3628
#include<stdio.h>

int main(void){
	int S,h,m,s;
	scanf("%d",&S);
	if("0<=S<86400"){
		s=S%60;
		m=(S-s)%3600/60;
		h=(S-s-60*m)/3600;
		printf("%d:%d:%d\n",h,m,s);
	}
	return 0;
}

Measured memory_bytes: 592
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

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;}

const ll INF=1e18;

int main()
{
    ll a,b;
    cin >> a >> b;
    if(abs(a-b)<=1) cout << "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
} 


Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
k = Counter(a)
b = list(k.values())
b = [1 if bb % 2 == 1 else 2 for bb in b]
over_2 = [bb for bb in b if bb >= 2]
if len(over_2) == 0:
    print(len(b))
elif len(over_2) % 2 == 0:
    print(len(b))
else:
    print(len(b) - 1)



Measured memory_bytes: 18648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
const int maxn=1e3+7;

int main()
{
    int a[maxn][maxn];
    bool b[maxn];    
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<n;j++)
            cin>>a[i][j];
        a[i][0]=1;
    }
    int sum1=0,sum=0,s=0;
    while(1){
        s=0;
        memset(b,0,sizeof b);
        for(int i=1;i<=n;i++){
            if(a[i][0]==n) continue;
            int v=a[i][a[i][0]];
            if(b[i]==0&&b[v]==0&&i==a[v][a[v][0]]){
                if(s==0) s=1,sum++;
                a[i][0]++;
                a[v][0]++;
                b[i]=b[v]=1;
            }
        }
        if(sum1!=sum) sum1=sum;
        else {
            for(int i=1;i<=n;i++)
            if(a[i][0]<n){
                printf("-1\n");
                return 0;
            }
            else {printf("%d\n",sum);return 0;}
        }
    }
    return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
int n,m,a[101];
int main()
{
    int sum=0,count=0;
    int basic;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    if(sum%(4*m)==0)
        basic=sum/(4*m);
        else
            basic=sum/(4*m)+1;
       for(int i=0;i<n;i++)
       {
           if(a[i]>=basic)
            count++;
       }
       if(count>=m)
        cout<<"Yes"<<endl;
       else
        cout<<"No"<<endl;
       return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define M 210

int main(void){
  int i,j;
  int n,m;
  int card[M];
  int shu;
  int cuca[M];
  int cucac;
  int rica[M];
  int ricac;

  scanf("%d%d",&n,&m);
  for(i=0;i<2*n;i++)
    card[i]=i+1;
  for(i=0;i<m;i++){
    scanf("%d",&shu);
    if(shu>0){
      for(j=0,cucac=2*n-shu;j<shu;j++,cucac++){
        cuca[cucac]=card[j];
      }
      for(cucac=0;j<2*n;j++,cucac++){
        cuca[cucac]=card[j];
      }
      for(j=0;j<2*n;j++){
        card[j]=cuca[j];
      }
    }
    if(shu==0){
      for(j=0,ricac=0;ricac<n;j+=2,ricac++){
        rica[j]=card[ricac];
      }
      for(j=1;ricac<2*n;j+=2,ricac++){
        rica[j]=card[ricac];
      }
      for(j=0;j<2*n;j++){
        card[j]=rica[j];
      }
    }
  }
  for(i=0;i<2*n;i++){
    printf("%d\n",card[i]);
  }

  return 0;
}

Measured memory_bytes: 0
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let k = read_as_vec::<i32>()[0];

    let even = k/2;
    let odd = k - even;

    println!("{}", even*odd);
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int N; 
	cin >> N;
	int X;
	cin >> X;
	int T;
	cin >> T;
	int a;

	if (N % X > 0)
	{
		a = (N / X + 1)*T;
	}
	else
	{
		a = N / X * T;
	}
	cout << a << endl;
}

Measured memory_bytes: 3580
package main

import (
	"fmt"
)

func main() {
	var N, r int
	fmt.Scan(&N)
	va := make([]int, N)
	ca := make([]int, N)
	for i := range va {
		fmt.Scan(&va[i])
	}
	for i := range ca {
		fmt.Scan(&ca[i])
	}
	for i := 0; i < N; i++ {
		if va[i] > ca[i] {
			r += va[i] - ca[i]
		}
	}
	fmt.Println(r)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(auto _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa

using namespace std;

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n; cin >> n;
  ll d, x, y; cin >> d; d *= d;
  int i, j, z, ans = 0;
  for (i = 1; i <= n; i++) {
    cin >> x >> y;
    if (x*x + y*y <= d) ans++;
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3636
def power(i)
  if i == 0
    0
  else
    Math.log10(i.abs).to_i + 1
  end
end

def is_753?(i)
  x = i.to_s
  s,f,t=false
  x.each_char do |c|
    case true
    when c == "3"
      t=true
      return true if s&&f&&t
    when c == "5"
      f=true
      return true if s&&f&&t
    when c == "7"
      s=true
      return true if s&&f&&t
    else
      return false
    end
  end
  s&&f&&t
end

def f(i)
  s = i.to_s
  digits = s.length
  result = 0
  (3..digits).each do |ds|
    [3, 5, 7].repeated_permutation(ds).each do |is|
      n = is.reduce(0) do |memo, item|
        memo + item * (10 ** power(memo))
      end
      # puts n
      if n <= i && is_753?(n)
        result += 1
      end
    end
  end
  result
end

N = $stdin.read.chomp.to_i
puts f(N)


Measured memory_bytes: 1916
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int h,w;
  cin>>h>>w;
  char s[h][w];
  rep(i,h) {
    rep(j,w) cin>>s[i][j];
  }
  int dx[4] = {-1, 0, 0, 1};
  int dy[4] = {0, 1, -1, 0};
  rep(i,h) {
    rep(j, w) {
      if(s[i][j] == '.') continue;
      bool flag = false;
      rep(k, 4) {
        int ny = i + dy[k];
        int nx = j + dx[k];
        if(nx >= 0 && nx < w && ny >= 0 && ny < h) {
          if(s[ny][nx] == '#') flag = true;
        }
      }
      if(!flag) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;

  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


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




int main() {
    ll n;
    cin >> n;
    vector<ll> A(n);
    vector<ll> B(n);
    vector<ll> C(n);
    vector<ll> a;
    vector<ll> b;
    vector<ll> c;
    REP(i,n){
        cin >> A[i];
    }
    REP(i,n){
        cin >> B[i];
    }
    REP(i,n){
        cin >> C[i];
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    // REP(i, n){
    //     if(i >0){
    //         if(a[a.size()-1] == A[i]) continue;
    //     }
    //     a.push_back(A[i]);
    // }
    // REP(i, n){
    //     if(i >0){
    //         if(b[b.size()-1] == B[i]) continue;
    //     }
    //     b.push_back(B[i]);
    // }
    // REP(i, n){
    //     if(i >0){
    //         if(c[c.size()-1] == C[i]) continue;
    //     }
    //     c.push_back(C[i]);
    // }
    ll ans = 0;
    REP(i, B.size()){
        //cout << "b= " << B[i] << endl;
        ll num_a = (lower_bound(A.begin(),A.end(),B[i]) - A.begin());
        //cout << num_a << endl;
        ll num_c = C.size() - (upper_bound(C.begin(),C.end(),B[i]) - C.begin()) ;
        //cout << num_c << endl;
        ans += num_a * num_c;
    }
    cout << fixed << ans << endl;

}



Measured memory_bytes: 2560
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t N, a[(int)2e5 + 1];
    intmax_t box[(int)2e5 + 1] = {0}, M = 0;

    scanf("%jd", &N);
    for (size_t i = 1; i <= N; i++) {
        scanf("%jd", &a[i]);
    }

    for (size_t i = N; i > 0; i--) {
        intmax_t balls = 0;
        for (size_t j = (i * 2); j <= N; j += i) {
            balls += box[j];
        }
        if (a[i] != (balls % 2)) {
            M++;
            box[i] = 1;
        }
    }

    printf("%jd\n", M);
    if (M <= 0) return 0;
    for (size_t i = 1; i <= N; i++) {
        if (box[i]) {
            printf("%zd", i);
            if (--M) {
                printf(" ");
            } else {
                printf("\n");
                break;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3968
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#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++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;

int main() {
  int d,n,m;
  cin >> d >> n;
  m = pow(100,d);
  if(n<100) cout << m * n << endl;
  else cout << m * 101 << endl;
}




Measured memory_bytes: 256
/*****************************

          D - Watch

*****************************/

#include<stdio.h>

int main(void)
{
	long S;
	long h, m, s;

	scanf("%d", &S);

	h = S / (60 * 60);

	m = ( S % (60 * 60) ) / 60;

	s = S % 60;

	printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<string>

using namespace std;

int main(){
   int i;//文字列の長さ
   string s;

   cin >> s;
   i = s.size() - 1;
   while(true){
      if(i % 2 == 0){
         if(s.substr(0, i/2) == s.substr(i/2, i/2)){
            cout << i << endl;
            return 0;
         }
      }
      i--;
   }
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int x; cin>>x;
    int ans;
    if(x%11==0) ans=x/11*2;
    else if(x%11<=6) ans=x/11*2+1;
    else ans=x/11*2+2;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

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

int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    set<int> c;
    FOR(i,1,n){
      int mod = (i*i)%n; 
      c.insert(mod);
    }
    int count[5001]={0};
    vector<int> d;
    set<int>::iterator it = c.begin();
    for(;it!=c.end(); it++){
      d.push_back((*it));
    }
    FOR(i,0,d.size()){
      FOR(j,i+1,d.size()){
        count[ min( abs(d[i]-d[j]), n - abs(d[i]-d[j])) ]++;
      }
    }
    FOR(i,1,(n-1)/2+1){
      cout<<2*count[i]<<endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1104
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
 
static const double EPS = 1e-8;

struct Order{
  int type;
  int pos;
  int action;
  Order(int _t,int _p,int _a) : type(_t),pos(_p),action(_a) {}
};

bool is_used_row[50001];
bool is_used_col[50001];

int main(){
  int total_rows,total_cols,total_queries;

  while(~scanf("%d %d %d",&total_rows,&total_cols,&total_queries)){
    if(total_rows == 0 && total_cols == 0 && total_queries == 0) break;

    vector<Order> orders;
    memset(is_used_row,false,sizeof(is_used_row));
    memset(is_used_col,false,sizeof(is_used_col));

    ll remaining_row = total_rows;
    ll remaining_col = total_cols;

    for(int query_idx = 0; query_idx < total_queries; query_idx++){

      int order_type;
      int pos;
      int action;
      scanf("%d %d %d",&order_type,&pos,&action);
      orders.push_back(Order(order_type,pos,action));
    }

    ll occupied_seats = 0;
    for(int query_idx = total_queries -1; query_idx >= 0; query_idx--){
      
      //row
      if(orders[query_idx].type == 0){
        if(is_used_row[orders[query_idx].pos]) continue;

        is_used_row[orders[query_idx].pos] = true;

        //0:sit 1:stand up
        if(orders[query_idx].action == 1) {
          occupied_seats += remaining_col;
        }
        remaining_row--;
      }

      //col
      else if(orders[query_idx].type == 1){
        if(is_used_col[orders[query_idx].pos]) continue;

        is_used_col[orders[query_idx].pos] = true;

        //0:sit 1:stand up
        if(orders[query_idx].action == 1) {
          occupied_seats += remaining_row;
        }
        remaining_col--;
      }
    }
    printf("%lld\n",occupied_seats);
  }
}

Measured memory_bytes: 2448
#include<stdio.h>
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> l(m);
    vector<int> r(m);

    for(int i = 0; i < m; i++) {
        cin >> l[i] >> r[i];
    }

    int ans = 0;
    int mi, ma;
    if(m == 1) {
      ans = r[0] - l[0] + 1;
    } else {
          sort(l.begin(), l.end());
          sort(r.begin(), r.end());
          ans =  r[0] - l[m-1] + 1;
          if(ans < 0) ans = 0;
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 1024
n = int(input())
H = list(map(int,input().split()))
dp = [float('INF')]*n
dp[0] = 0

for i in range(1,n):
  dp[i] = min(dp[i], dp[i-1]+abs(H[i]-H[i-1]))
  if i > 1:
  	dp[i] = min(dp[i], dp[i-2]+abs(H[i]-H[i-2]))
print(dp[-1])

Measured memory_bytes: 20656
/*
  AOJ 0268
  Title:Kongo Type
  @kankichi573
*/
#include <stdio.h>
#include <float.h>
#include <string.h>


main()
{
        double xx;
        int x,i,j,Q,sign;
        char buf[100];

        scanf("%d",&Q);
        //printf("Q=%d\n",Q);
        for(i=0;i<Q;i++)
        {
                scanf("%x",&x);
                if(x & 1<<31)
                {       sign=-1;
                        x &= 0x7fffffff;
                }
                else
                        sign=1;
                xx=x/128.0;
                if(x & 0x3f)
                {
                        sprintf(buf,"%0.7lf",sign*xx);
                        j=strlen(buf)-1;
                        while(buf[j]=='0')
                                buf[j--]='\0';
                        printf("%s\n",buf);
                }
                else
                        printf("%.1f\n",sign*xx);

        }

        
  return(0);
}

Measured memory_bytes: 660
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

  Scanner sc;

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

  int ni() {
    return sc.nextInt();
  }

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

  String retro(String str) {
    StringBuilder sb = new StringBuilder();
    for (int i = str.length() - 1; 0 <= i; --i) {
      sb.append(str.charAt(i));
    }
    return sb.toString();
  }

  void run() {
    int n = ni();
    for (int i = 0; i < n; ++i) {
      String str = sc.next();
      HashSet<String> set = new HashSet<>();
      set.add(str);
      for (int l = 1; l <= str.length() - 1; ++l) {
        String left = str.substring(0, l);
        String right = str.substring(l, str.length());
        set.add(left + retro(right));
        set.add(retro(left) + retro(right));
        set.add(retro(left) + right);

        set.add(right + left);
        set.add(retro(right) + left);
        set.add(retro(right) + retro(left));
        set.add(right + retro(left));
      }
      System.out.println(set.size());
    }
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

Measured memory_bytes: 61732
#include<bits/stdc++.h>
namespace FastIO{const char* ln="\n";struct Reader{char buf[1<<20],*s,*t;bool EOF_FLG;Reader():s(buf),t(buf),EOF_FLG(false) {};char gt() {return s==t&&((t=(s=buf)+fread(buf,1,1<<20,stdin))==s)?EOF:(*s++);}Reader& operator>>(char* str) {if(EOF_FLG)return *str=0,*this;while((*str=gt())!=' '&&*str!='\n'&&*str!=EOF)++str;if(*str==EOF)EOF_FLG=true;*str=0;return *this;}template<typename T>Reader&operator>>(T&x) {if(EOF_FLG)return *this;char c=0,d;while(c!=EOF&&(c<'0'||c>'9'))d=c,c=gt();if(c==EOF){EOF_FLG=true;return *this;}else x=0;while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+c-'0',c=gt();if(d=='-')x=-x;return *this;}}in;struct Writer{char buf[1<<20],*s,*t;Writer():s(buf),t(buf+(1<<20)){}~Writer(){fwrite(buf,1,s-buf,stdout);}void pt(char c){(s==t)?(fwrite(s=buf,1,1<<20,stdout),*s++=c):(*s++=c);}template<typename T>Writer&operator<<(T x){if(!x)return pt('0'),*this;if(x<0)pt('-'),x=-x;char a[40],t=0;while(x)a[t++]=x%10,x/=10;while(t--)pt(a[t]+'0');return *this;}Writer&operator<<(const char*s) {while(*s)pt(*s++);return *this;}}out;}using namespace FastIO;
namespace ZDY{
    #define ll long long
    #define db double
    #define sht short
    #define MB template <class T>
    #define Fur(i,x,y) for(int i=x;i<=y;i++)
    #define fur(i,x,y) for(i=x;i<=y;i++)
    #define Fdr(i,x,y) for(int i=x;i>=y;i--)
    #define fdr(i,x,y) for(i=x;i>=y;i--)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define inf 0x3f3f3f3f
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define l2(n) (int(log2(n)))
    #define fl(i,x) for(int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define fcin ios::sync_with_stdio(false)
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>=y?x:y;}
    MB T MIN(T x,T y){return x<=y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    void SWAP(int &x,int &y){x^=y;y^=x;x^=y;}
}using namespace ZDY;using namespace std;
#define N 1000011
int n,m;
int v[40];
int main(){
    in>>n>>m;
    Fur(i,1,n){
        int t,x;
        in>>t;
        while(t--)in>>x,v[x]++;
    }
    int ans=0;
    Fur(i,1,m)if(v[i]==n)ans++;
    out<<ans<<ln;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 998244353;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;

#define Endl endl

/*--------------------template--------------------*/


int main() {
    cin >> n >> m;
    k = m - n;
    REP(i, k) {
        ans += (i + 1);
    }
    cout << ans - m << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int a[] = new int[n];
            int count[] = new int[n+1];

            for(int i=1;i<n;i++){
			  a[i]=sc.nextInt();
			  count[a[i]]++;
            }

            for(int i=1;i<n+1;i++){
              System.out.println(count[i]);
            }
          }
}


Measured memory_bytes: 62712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PAIR;
const int N = 1e3+5;
const int INF = 0x3f3f3f3f;

int main(){
	int x,y,z;
	cin >> x >> y >> z;
	swap(x,y);
	swap(x,z);
	printf("%d %d %d\n",x,y,z);
    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/agc040/tasks/agc040_b

#include "algorithm"
#include "iostream"
#include "numeric"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

void solve() {
  ll N;
  cin >> N;

  ll max_l = 0;
  ll min_r = 1e18;

  VPL originals(N);
  rep(i, N) {
    ll l, r;
    cin >> l >> r;
    // [l, r)
    r++;
    originals[i] = {l, r};
    chmax(max_l, l);
    chmin(min_r, r);
  }

  ll res = 0;

  // max_l, min_r を与えるものを同一グループにするケース
  {
    for (auto p : originals) {
      chmax(res, max(min_r - max_l, 0ll) + p.se - p.fi);
    }
  }

  // max_l, min_r を与えるものを同一グループにしないケース
  {
    VPL ps(N);  // f: max(r_i - max_l, 0), s: max(min_r - l_i, 0)

    // s, t の 2 グループに分ける
    // s には max_l を与えるものを、t には min_r を与えるものを入れる
    // s グループの値は min(max(p.second - max_l, 0))
    // t グループの値は min(max(min_r - p.first, 0))
    // となる。
    // 上記２つの値を持った pair N 個を 2 グループに分け、 s については first, t
    // については second の min を取る
    rep(i, N) {
      ps[i] = {
          max(originals[i].se - max_l, 0ll),
          max(min_r - originals[i].fi, 0ll),
      };
    }

    sort(ps.begin(), ps.end(), [](auto& a, auto& b) {
      if (a.fi == b.fi) return a.se > b.se;
      return a < b;
    });

    ll min_t = 1e18;

    // 先頭を t に、残りを s に
    rep(i, N - 1) {
      PL new_t = ps[i];

      chmin(min_t, new_t.second);
      ll min_s = ps[i + 1].first;

      chmax(res, min_t + min_s);
    }
  }

  cout << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 3328
#include<iostream>
#include<map>
using namespace std;
#define MAX_N 200000

class Tree{
    public:
    void initialize(int n);
    int findParent(int x);
    void connectNodes(int x, int y);
    private:
    int parent[MAX_N];
    int depth[MAX_N];
};

void Tree::initialize(int n){
    for (int i=0; i<n; i++){
        //結合前は親は自身
        parent[i] = i; 
        depth[i] = 0;
    }
}

int Tree::findParent(int x){
    if (parent[x] == x) return x;
    else return parent[x] = findParent(parent[x]); //再帰的に親を探索
}

void Tree::connectNodes(int x, int y){
    x = findParent(x);
    y = findParent(y);
    if (x == y) return; //親が同じ場合
    if (depth[y] > depth[x]){ //yのほうが木が大きい場合
        parent[x] = y;
    }else{
        parent[y] = x;
        if (depth[x] == depth[y]) depth[x]++; //一段だけ木が深くなる
    }
}

int main(){
    int N, K, L;
    cin >> N >> K >> L;

    Tree road, rail;
    road.initialize(N); rail.initialize(N);

    for (int i=0; i<K; i++){
        int p, q;
        cin >> p >> q;
        road.connectNodes(p-1, q-1);
    }
    for (int i=0; i<L; i++){
        int r, s;
        cin >> r >> s;
        rail.connectNodes(r-1, s-1);
    }

    map<pair<int, int>, int> ans;
    for (int i=0; i<N; i++){
        ans[make_pair(road.findParent(i),rail.findParent(i))]++;
    }
    for (int i=0; i<N; i++){
        cout << ans[make_pair(road.findParent(i),rail.findParent(i))] << " ";
    }
    return 0;
}

Measured memory_bytes: 17928
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  unsigned long long N;
  cin >> N;
  unsigned long long amount = 0;
  unsigned long long i = 0;
  while (i <= N)
  {
   if (i % 3 == 0 || i % 5 == 0)
     amount += 0;
    else 
      amount += i;
    i++;
  }
  
  cout << amount << endl;
}

Measured memory_bytes: 3636
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll n,rsum=0,wsum=0;
  ll ans = 0;
  string s;
  vector<ll> rp;
  cin >> n >> s;
  for(auto c:s){
    if(c=='R') rsum++;
    else wsum++;
  }
  for(int i=0;i<rsum;i++){
    if(s[i]=='W'){
      ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int a, b;
    cin >> a >> b;
    if ((a * b) % 2 == 0)
        cout << "Even" << endl;
    else
        cout << "Odd" << endl;
    return 0;
}

Measured memory_bytes: 3636
/*
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#define N 100
double pop();
void push(double );
char s[N];
int i=0;

int main(){
  //int c;
  char x;
  double a,b,c;
  while(scanf("%c",&x) != EOF){
    if(isdigit(x)){
      //scanf("%d",&x);
      //c=atoi(x);
      push(x-'0');
    }else{
      switch(x){
        case '+':
          b=pop();a=pop();
          push(a+b);
          break;
        case '-':
          b=pop();a=pop();
          push(a-b);
          break;
        case '*':
          b=pop();a=pop();
          push(a-b);
          break;
        case '/':
          b=pop();a=pop();
          push(a/b);
          break;
        default:
          break;
      }
    }
  }
  printf("%f\n",pop());
  return 0;
}
double pop(){
  if(i<0) printf("error\n");
  else return s[--i];
}
void push(double a){
  if(i<100) s[i++] = a;
  else return;
}
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
typedef double ELEM;
#define STACK_SIZE 100
void error(char *);
void init();
void push(ELEM);
ELEM pop();
int empty();

ELEM stack[STACK_SIZE];
int n;

int main(){
	int c;
	double x,a,b;
	init();
	while((c=getchar()) != EOF){
		if(isdigit(c)){
			ungetc(c,stdin);
			scanf("%lf",&x);
			push(x);
		}else{
			switch(c){
				case '+':
					b=pop();a=pop();
					push(a+b);
					break;
				case '-':
					b=pop();a=pop();
					push(a-b);
					break;
				case '*':
					b=pop();a=pop();
					push(a*b);
					break;
				case '/':
					b=pop();a=pop();
					push(a/b);
					break;
				case '\n':
					if(!empty()) printf("%d\n",(int)pop());
					init();
					return 0;
					break;
				case ' ':
				case '\t':
					break;
				default:
					printf("error\n");
					printf("input again\n");
					while((c=getchar()) != EOF && c != '\n')
						;
					break;
			}
		}
	}
}
void error(char *s){
	fprintf(stderr,s);
	exit(1);
}
void init(){
	n=0;
}
void push(ELEM x){
	if(n>=STACK_SIZE) error("stack overflow!\n");
	stack[n++] = x;
}
ELEM pop(){
	if(n<=0) error("stack underflow!\n");
	return stack[--n];
}
int empty(){
	return n==0;
}


Measured memory_bytes: 2104