akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];

const int mod = 1000000007;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}


signed main() {
	int n, a=0, b=INF,c;
	cin >> n;
	rep(i, n) {
		cin >> c;
		a = max(a, c);
		b = min(b, c);
	}
	cout << a - b << endl;
}


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

int main(){
  int A,B,K;
  cin >> A >> B >> K;
  
  for(int k=0; k<K; k++){
    if(k%2==0){
      if(A%2 != 0){ A--; }
      int diff= A/2;
      A-= diff;
      B+= diff;
    }
    else{
      if(B%2 != 0){ B--; }
      int diff= B/2;
      B-= diff;
      A+= diff;
    }
  }

  cout << A <<" "<< B << endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
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;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



int n;

signed main() {
    cin >> n;
    cout << 180 + (n-3)*180 << endl;
}


Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a  = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        if (sc != null) {
            sc.close();
        }
        Map<Integer, Integer> map = new TreeMap<Integer, Integer>();
        for (int i = 0 ; i < n ; i++) {
            map.put(a[i], i + 1);
        }

        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            System.out.print(entry.getValue());
            System.out.print(" ");
        }
    }

}

Measured memory_bytes: 70880
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    if "RRR" in S:
        ans = 3
    elif "RR" in S:
        ans = 2
    elif "R" in S:
        ans = 1
    else:
        ans = 0

    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
  string s;
  vector<int>n(26,0);
  cin >> s;
  for(int i=0;i<s.size();i++){
    n.at(s.at(i)-97) +=1;
  }
  bool c = true;
  for(int i=0;i<26;i++){
    if(n.at(i)%2!=0){
      c = false;
      break;
    }
  }
  if(c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define clr(ar, val) memset(ar, val, sizeof(ar))
#define sbp(p, n) rep(i, n) { int a, b; scanf("%d %d", &a, &b); p[i] = make_pair(a, b); }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
using namespace std;

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

int main(void)
{
  //int a, b, c; cin >> a >> b >> c;
  //int n, k; cin >> n >> k;
  char a[11]; cin >> a;
  int b[11] = {}, j = 0;
  int ans = 0;
  rep(i, strlen(a)){
    if(a[i] == 'A' || a[i] == 'C' || a[i] == 'G' || a[i] == 'T'){
      ans++;
    }else{
      b[j++] = ans;
      ans = 0;
    }
  }
  rep(i, 11) chmax(ans, b[i]);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
using namespace std;
long long mod = 1000000000 + 7;

int main()
{
	int n;
	cin >> n;
	
	vector<pair<pair<string,int>,int>> a;

	for (int i = 0; i < n; i++) {
		pair<string, int> ai;
		int p;
		string s;
		cin >> s >> p;
		ai.first = s;
		ai.second = p * (-1);

		pair<pair<string, int>,int> ain;

		ain.first = ai;
		ain.second = i + 1;
		a.push_back(ain);
	}
		
	sort(a.begin(), a.end());
	
	for (int i = 0; i < n; i++) {
		cout << a[i].second<< endl;
	}

	//cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc059_a
{
    class Program
    {
        public static void Main()
        {
            string[] s = Console.ReadLine().Split(' ');
            string answer = "";
            for (int i = 0; i < s.Length; i++)
            {
                answer += s[i][0].ToString().ToUpper();
            }

            Console.WriteLine(answer);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>

void swap(int *a,int *b)
{
    int i = *a;
    *a = *b;
    *b = i;
    
}


int main ()
{
    int x,y;
    
    scanf("%d %d",&x,&y);
    int flag = 1;
    while(flag)
    {
        flag = 0;
        x %= y;
        
        if(x == 0)
            break;
        
        swap(&x,&y);
        flag = 1;
        
    }
    printf("%d\n",y);
    return 0;
    
    
}



Measured memory_bytes: 2108
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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

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


	cout << 3 - ((a == b) + (b == c) + (c == a)) + (a==b&&b==c&&c==a) << endl;
	return 0;
}

Measured memory_bytes: 256
<?php

while ($stdin = fgets(STDIN)) {
    $line[] = trim($stdin);
}
foreach ($line as $key => $value) {
    $data[] = explode(' ', $value);
}

//foreach ($data as &$line) {
//    $line = array_map(function($val) { return (int)$val; }, $line);
//}

$s = $data[0][0];
$K = $data[1][0];

$alphabetKey = 0;
$length = strlen($s);

$founds = [];

for ($smallK = 1; $smallK <= $K; $smallK++) {
    for($start = 0; $start < $length + 1 - $smallK; $start++) {
        $founds[] = substr($s, $start, $smallK);
    }
}

$founds = array_values(array_unique($founds));
sort($founds);

$ans = $founds[$K - 1];
printf('%s', $ans);

?>


Measured memory_bytes: 8696
# coding: utf-8
# hello worldと表示する
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,c=MI()
dp=[[0]*c for i in range(10**5+1)]
for i in range(n):
    s,t,ch=MI()
    for j in range(s,t+1):
        dp[j][ch-1]=1
mx=0
#print(dp)
for i in range(10**5):
    u=sum(dp[i])
    if u>mx:
        mx=u
print(mx)

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;



int main () {
   	SpeedForce;
   	int a, b;
   	cin >> n >> a >> b;
   	if (a + b - 1 > n || a * (ll)b < n) {
   		cout << "-1\n";
   		exit(0);
   	}

   	for (int i = a - 1; i >= 0; --i) {
   		int len = min(n - i, b);
   		cur += len;
   		for (int j = 0; j < len; ++j)
   			cout << cur - j << ' ' ;
   		n -= len;
   	}

   	return Accepted;
}

// B...a

Measured memory_bytes: 20736
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int A, B, C;

    scanf("%d%d%d", &A, &B, &C);

    int t = 0;

    for(int i = 0; i < B; i++){
        if((A * i) % B == C){
            t = 1;
            break;
        }
    }

    if(t == 1){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 1608
import networkx as nx

N = int(input())
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(Q)]

G = nx.Graph()

for a, b, c in ABC:
    G.add_edge(a - 1, b - 1, weight=c)

pred, dist = nx.dijkstra_predecessor_and_distance(G, K - 1)

for x, y in XY:
    print(dist[x - 1] + dist[y - 1])



Measured memory_bytes: 222268
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#define ll long long
using namespace std;

void dfs(vector<char> ngo,ll d,ll n,vector<bool> table,ll count){
    if(d <= n){
        for(ll i = 0;i<26;i++){
            if(table[i]){
                ngo.push_back('a'+i);
                dfs(ngo,d+1,n,table,count);
                ngo.pop_back();
            }
        }
        table[count] = true;
        ngo.push_back('a'+count);
        dfs(ngo,d+1,n,table,count+1);
        table[count] = false;
        ngo.pop_back();
    }else{
        for(char a:ngo) cout<<a;
        cout<<endl;
    }
}

int main(void){
    ll n; cin>>n;
    dfs(vector<char>(),1,n,vector<bool>(26,false),0);
}


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

int f[100005];

int main() {

    int n;
    int a, b;
    cin >> n;

    rep(i, n) {
        cin >> a >> b;
        f[a]++;
        f[b+1]--;
    }

    int sum=1;
    int ans=0;
    rep(i, 100005) {
        sum += f[i];
        if (i <= sum) {
            ans=i;
        }
    }

    cout << ans-1 << endl;
}

Measured memory_bytes: 3496
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int N;
int K;
int D;
int S;
int Sum;
bool C[101];

int main()
{
	scanf("%d %d", &N, &K);
	for(int I=1; I<=K; I++)
	{
		scanf("%d", &D);
		for(int J=1; J<=D; J++)
		{
			scanf("%d", &S);
			C[S] = true;
		}
	}
	for(int I=1; I<=N; I++)
	{
		if(C[I] == false)
		{
			Sum++;
		}
	}
	printf("%d", Sum);
	return 0;
}

Measured memory_bytes: 3800
function main(lines) {
  const [N, A, B] = ba();

  const turn = N / (A+B);
  const rest = N % (A+B);
  const ans = A*turn + (A < rest ? A : rest);
  
  return ans.toString();
}



const lines = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");

let lineCount = 0;
const s = () => lines[lineCount++];
const n = () => Number(s());
const b = () => BigInt(s());
const sa = () => s().split(' ');
const na = () => sa().map(Number);
const ba = () => sa().map(BigInt);

const ans = main(lines);
console.log( ans );

Measured memory_bytes: 29648
#include <cstdio>
#include <algorithm>

using namespace std;

int main ()
{
    //freopen ("file.in", "r", stdin);

    int a, b, c, d, n;
    scanf ("%d %d %d %d %d", &a, &b, &c, &d, &n);

    a *= 4;
    b *= 2;

    int mi1 = min (min (a, b), c);
    int mi2 = d;

    long long ans = 0LL;
    if (mi2 < mi1 * 2)
    {
        ans += 1LL * (n / 2) * mi2;
        n %= 2;
    }

    ans += 1LL * n * mi1;

    printf ("%lld\n", ans);

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int>f(n,0);
  rep(i,n){
    rep(j,10){
      int t;
      cin >> t;
      if(t == 1) f[i]|= (1<<j);
    }
  }
  vector<vector<int>>p(n,vector<int>(11));
  rep(i,n){
    rep(j,11){
      cin >> p[i][j];
    }
  }
  ll max = -1e9-5;
  for (int bit = 1; bit < (1<<10); ++bit){
    ll sum = 0;
    rep(i,n){
      int cnt = 0;
      rep(j,10){
        if((bit & (1<<j))&&(f[i] & (1<<j))) cnt++;
      }
      sum += p[i][cnt];
    }
    if(sum > max) max = sum;
  }
  cout << max << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = []
B = []
for i in range(N):
  A.append(input())
for i in range(K):
  B.append(input())

frag = False
for i in range(N - K + 1):
  for j in range(N - K + 1):
    f = True
    for k in range(K):
      for l in range(K):
        if A[i + k][j + l] != B[k][l]:
          f = False
    if f:
      frag = True
print("YNeos"[not frag::2])

Measured memory_bytes: 3064
s = list(input())

def calc(i, a, b):
  a ,b = int(a), int(b)
  if i==0:
    c = a+b
  elif i==1:
    c = a-b
  return c
 
def tag(t_list):
  t = []
  for p in t_list:
    if p==0:
        t.append('+')
    else:
        t.append('-')
  return(t)
    
for i in range(2):
  c = calc(i,s[0],s[1])
  for j in range(2):
    d = calc(j,c,s[2])
    for k in range(2):
      e = calc(k,d,s[3])
      if e == 7:
        t_list = [i,j,k]
        t = tag(t_list)
        print(s[0]+t[0]+s[1]+t[1]+s[2]+t[2]+s[3]+'=7')
        exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[200005];
int main()
{
    int n;
    ll k;
    while(cin>>k>>n)
    {
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        ll res=1e18;
        for(int i=1;i<n;i++)
        {
            res=min(res,k-(arr[i]-arr[i-1]));
        }
        //cout<<res<<endl;
        ll x1=arr[0]+(k-arr[n-1]);
        res=min(res,k-x1);
        cout<<res<<endl;

    }
}


Measured memory_bytes: 1792
N = int(input())
S = input()
MOD = 10**9+7
d = {}
for i in range(N):
  if S[i] in d:
    d[S[i]].append(i)
  else:
    d[S[i]] = [i]
ans = 1
for k,v in d.items():
  ans *= len(v)+1
  ans %= MOD
print((ans-1)%MOD)


Measured memory_bytes: 45296
#include<cstdio>

using namespace std;

int main(){

    char s[5];
    int ans = 0;
    scanf("%s", s);
    for(int i = 0; i < 4; i++){
        if (s[i] == '+') ans++;
        else ans--;
        
    }
    printf("%d\n", ans);
}

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

int main(){
    char c;
    cin >> c;
    if(c == 'A')
    	cout << 'T' << endl;
    else if(c == 'T')
    	cout << 'A' << endl;
    else if(c == 'G')
    	cout << 'C' << endl;
    else
    	cout << 'G' << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                           //     #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;
                                        
                                  class pas{
                                    	public:
                                    	int x,y;
                                    	pas(int x=0,int y=0):x(x),y(y) {}
                                    	pas operator + (pas p) {return pas(x+p.x,y+p.y);}
                                    	pas operator - (pas p) {return pas(x-p.x,y-p.y);}
                                    	pas operator * (int a) {return pas(x*a,y*a);}
                                    	pas operator / (int a) {return pas(x/a,y/a);}
                                    //	double absv() {return sqrt(norm());}
                                    	int norm() {return x*x+y*y;}
                                    	bool operator < (const pas &p) const{
                                    		return x != p.x ? x<p.x: y<p.y;
                                    	}
                                    	bool operator == (const pas &p) const{
                                    		return x==p.x && y==p.y;
                                    	}
                                    };
int a[60]={0};
           signed main(){
      int n;
           	cin>>n;
           	
           	for(int i=0;i<100000;i++){
           		if(i*i>n){
           			cout<<(i-1)*(i-1)<<endl;
           			return 0;
           		}
           	}
           	
           }
             

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

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    unordered_multimap<int, int> frends;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        frends.emplace(a, b);
        frends.emplace(b, a);
    }
    unordered_multimap<int, int> blocks;
    for (int i = 0; i < k; i++) {
        int a, b;
        cin >> a >> b;
        blocks.emplace(a, b);
        blocks.emplace(b, a);
    }
    unordered_map<int, int> g;
    for (int i = 1; i <= n; i++) {
        if (g.count(i) == 0) {
            unordered_set<int> vs;
            stack<int> q;
            q.push(i);
            while(!q.empty()) {
                int v = q.top();
                q.pop();
                if (vs.count(v) == 0) {
                    vs.emplace(v);
                    auto its = frends.equal_range(v);
                    for (auto it = its.first; it != its.second; ++it) {
                        q.push(it->second);
                    }
                }
            }
            for (int v : vs) {
                int count = vs.size() - 1;
                auto itfs = frends.equal_range(v);
                for (auto it = itfs.first; it != itfs.second; ++it) {
                    if (vs.count(it->second) != 0) {
                        count--;
                    }
                }
                auto itbs = blocks.equal_range(v);
                for (auto it = itbs.first; it != itbs.second; ++it) {
                    if (vs.count(it->second) != 0) {
                        count--;
                    }
                }
                g.emplace(v, count);
            }
        }
        if (i != 1) {
            cout << " ";
        }
        cout << g[i];
    }
    cout << endl;

    return 0;
}

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

int main() {
  int d,t,s;cin>>d>>t>>s;
  if (d > t*s) cout<<"No";
  else cout<<"Yes";
}


Measured memory_bytes: 3592
#include <stdio.h> 
int main(){ 
int a,b,i,d; 
while(1){ 
scanf("%d %d",&a,&b);
if(a==0 && b==0)break; 
for(i=0;i<a;i++){ 
for(d=0;d<b;d++) 
{ 
printf("#"); 
} 
printf("\n"); 
} 
printf("\n");
}
return 0; 
} 


Measured memory_bytes: 2044
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	} 
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	
	xy := map[int][]int{}
	yx := map[int][]int{}
	for i := 0; i < n; i++ {
		x := scanInt()
		y := scanInt()
		xy[x] = append(xy[x], y)
		yx[y] = append(yx[y], x)
	}

	uf := make(unionFind, 1e5+1)
	uf.init()

	for _, xs := range yx {
		pre := uf.find(xs[0])
		for i := 0; i < len(xs)-1; i++ {
			now := uf.find(xs[i+1])
			if pre != now {
				uf.unite(xs[i],xs[i+1])
			}
			pre = now
		}
	}

	cnt := map[int]map[int]bool{}
	for x, ys := range xy {
		xgrp := uf.find(x)
		if cnt[xgrp] == nil {
			cnt[xgrp] = map[int]bool{}
		}
		for _, y := range ys {
			cnt[xgrp][y] = true
		}
	}

	ans := 0
	for num, ymap := range cnt {
		ans += uf.size(num)*len(ymap)
	}

	fmt.Fprintln(wr, ans-n)

}

type unionFind []int

func (uf *unionFind) init() {
	for i := 0; i < len(*uf); i++ { (*uf)[i] = -1 }
}

func (uf *unionFind) find(x int) int {
	if (*uf)[x] < 0 { return x }
	(*uf)[x] = uf.find((*uf)[x])
	return (*uf)[x]
}

func (uf *unionFind) unite(x, y int) {
	x, y = uf.find(x), uf.find(y)
	if x != y {
		if (*uf)[x] > (*uf)[y] { x,y = y,x }
		(*uf)[x] += (*uf)[y]
		(*uf)[y] = x
	}
}

func (uf unionFind) size(x int) int {
	return -uf[uf.find(x)]
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
using namespace std;
int main () {
  string O, E;
  cin >> O >> E;
  for(int i = 0; i < E.size(); i++) {
    cout << O.at(i) << E.at(i);
  }
  if(O.size() != E.size()) cout << O.at(E.size()) << endl;
  else cout << endl;
}


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

#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) REP (i, 0, n)
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

const int MAX_N = 1000000;
bool prime[MAX_N];
void eratos() {
	rep(i, MAX_N) prime[i] = true;
	prime[0] = false;
	prime[1] = false;
	REP(i, 2, sqrt(MAX_N)) {
		if (prime[i]) {
			for (int j = 0; i * (j + 2) < MAX_N; ++j) {
				prime[i * (j + 2)] = false;
			}
		}
	}
}

int main() {
	eratos();
	int n;
	while (cin >> n) {
		int ans = 0;
		for (int i = 2; i <= n; ++i) {
			if (prime[i]) ans++;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2136
package main

import "fmt"

func main() {
        var s string
        fmt.Scan(&s)
        var findA bool
        var indexA, indexZ int
        for i := 0; i < len(s); i++ {
                if !findA && s[i] == 'A' {
                        indexA = i
                        findA = true
                }
                if findA && s[i] == 'Z' {
                        indexZ = i
                }
        }
        fmt.Printf("%d\n", indexZ-indexA+1)
}

Measured memory_bytes: 1920
#include<stdio.h>
int main(void)
{
int A, B;
char op;
scanf("%d %c %d", &A, &op, &B);
int answer;
  if(op == '+'){
    answer = A + B;
  } else if(op == '-'){
    answer = A - B;
  }
  printf("%d", answer);
  return 0;
}


Measured memory_bytes: 128
# coding: utf-8
h,w=map(int,input().split())
t=[]
for i in range(h):
    t.append(list(input()))
for i in range(h):
    for j in range(w):
        if t[i][j]=='#':
            tmp=0
            if i+1<h and t[i+1][j]=='#':
                tmp+=1
            if i-1>=0 and t[i-1][j]=='#':
                tmp+=1
            if j+1<w and t[i][j+1]=='#':
                tmp+=1
            if j-1>=0 and t[i][j-1]=='#':
                tmp+=1
            if tmp==0:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 3064
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REPR(i,n)   FORR(i,n,0)
#define int long long

using namespace std;
typedef pair<int, int> pii;

int n;
double p[3010]={0};
double dp[3010][3010]={0};

signed main() {
	cin>>n;
    rep(i,n){
        cin>>p[i];
    }

    dp[0][0]=1;
    dp[0][1]=0;
    rep(i,n){
        rep(j,i+2){
            if(j==0){
                dp[i+1][j]=dp[i][0]*(1-p[i]);
            }
            else if(j==i+1){
                dp[i+1][j]=dp[i][j-1]*p[i];
            }
            else{
                dp[i+1][j]=dp[i][j-1]*p[i]+dp[i][j]*(1-p[i]);
            }
        }
    }
	
    double res=0;
    rep(i,n+1){
        if(i>=(n+1)/2){
            res+=dp[n][i];
        }
    }

    printf("%.10lf\n",res);
	
	return 0;
}


Measured memory_bytes: 69120
#include <iostream>
#include <string>
typedef long long ll;
//#include <algorithm>
using namespace std;

int idx = 0;
int N, K;
string S;

int maxNum = 0;
int currentNum = 0;

int sameNum(int num){
  int value = 0;
  char numChar = '0' + num;
  while(idx < N && S[idx] == numChar){
    value++;
    idx++;
  }

  return value;
}

int main() {

  cin >> N >> K;

  cin >> S;

  int sameNums[100000];
  int sameNumIndex = 0;
  int lastIndex = 0;

  sameNums[sameNumIndex++] = sameNum(1);//最初のセクション
  //maxNum;//最大値
  currentNum = sameNums[0];//現在の値
  //cout << currentNum << endl;

  for(int i = 0; i < K; i++){
    sameNums[sameNumIndex++] = sameNum(0);
    sameNums[sameNumIndex++] = sameNum(1);
    currentNum += sameNums[sameNumIndex - 2];
    currentNum += sameNums[sameNumIndex - 1];

    if(idx == N){
      cout << N << endl;
      return 0;
    }
  }

  maxNum = currentNum;

  while(idx < N){
    sameNums[sameNumIndex++] = sameNum(0);
    sameNums[sameNumIndex++] = sameNum(1);
    currentNum += sameNums[sameNumIndex - 2];
    currentNum += sameNums[sameNumIndex - 1];

    currentNum -= sameNums[lastIndex++];
    currentNum -= sameNums[lastIndex++];

    if(currentNum > maxNum){
      maxNum = currentNum;
    }
    //cout << maxNum << endl;
  }

  cout << maxNum << endl;
}


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

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

    vector<int> sum(n + 1, 0);
    for (int i = 1; i < n; ++i)
    {
        sum[i + 1] = sum[i];
        if (s[i] == 'C')
            if (s[i - 1] == 'A')
                sum[i + 1] = sum[i] + 1;
    }
    while (q--)
    {
        int l, r;
        cin >> l >> r;
        int ans = sum[r] - sum[l];
        cout << ans << endl;
    }
}

Measured memory_bytes: 3824
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i32, i32>;

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    i32 n, t;
    cin >> n >> t;
    vector<P> a(n);
    rep(i, n) cin >> a[i].first >> a[i].second;
    sort(all(a));
    vector<vector<i32>> dp(n + 1,vector<i32> (t + 1,-1));
    dp[0][0] = 0;
    rep(i,n) {
        rep(j, t) {
            if (dp[i][j] != -1) {
                dp[i + 1][j] = max(dp[i + 1][j],dp[i][j]);
                if (j + a[i].first < t)
                    dp[i + 1][j + a[i].first] = max(dp[i + 1][j + a[i].first], dp[i][j] + a[i].second);
                else dp[i + 1][t] = max(dp[i][j] + a[i].second, dp[i + 1][t]);
            }
        }
        if(dp[i][t] != -1)dp[i + 1][t] = max(dp[i][t],dp[i + 1][t]);
    }
    i32 ans = 0;
    rep(i,t + 1)ans = max(ans,dp[n][i]);
    cout << ans << endl;
}

Measured memory_bytes: 73676
n = int(input())
k = int(input())
l = len(str(n))
a = [int(str(n)[i]) for i in range(l)]

dp = [[[0, 0] for _ in range(k + 1)] for _ in range(l)] #dp[i桁目][0でないのがj個][0: 未満, 1: 未満不確定]

dp[0][0][0] = 1         #0桁目で0でないのが0個、未満確定は0が入る1個
dp[0][0][1] = 0         #0桁目で0でないのが0個、未満不確定はa[0]!=0より0個
dp[0][1][0] = a[0] - 1  #0桁目で0でないのが1個、未満確定は1-a[0]-1のa[0]-1個
dp[0][1][1] = 1         #0桁目で0でないのが1個、未満不確定はa[0]の1個

#print(a)

for i in range(1, l):
    for j in range(k + 1):
        if j > 0 and a[i] != 0:
            #未満確定で0以外がj個のとき、0の1個
            #未満確定で0以外がj-1個のとき、1-9の9個
            #未満不確定で0以外がj個のとき、0の1個
            #未満不確定で0以外がj-1個のとき、1-a[i]-1のa[i]-1個
            dp[i][j][0] = dp[i-1][j][0] * 1 \
                        + dp[i-1][j-1][0] * 9 \
                        + dp[i-1][j][1] * 1 \
                        + dp[i-1][j-1][1] * (a[i] - 1)
            #未満不確定で0以外がj-1個のとき、a[i]の1個
            dp[i][j][1] = dp[i-1][j-1][1] * 1

        elif j > 0 and a[i] == 0:
            #未満確定で0以外がj個のとき、0の1個
            #未満確定で0以外がj-1個のとき、1-9の9個
            dp[i][j][0] = dp[i-1][j][0] * 1 \
                        + dp[i-1][j-1][0] * 9
            #未満確定で0以外がj個のとき、0の1個
            dp[i][j][1] = dp[i-1][j][1] * 1
        
        elif j == 0 and a[i] != 0:
            #未満確定で0以外がj個のとき、0の1個
            #未満不確定で0以外がj個のとき、0の1個
            dp[i][j][0] = dp[i-1][j][0] * 1 \
                        + dp[i-1][j][1] * 1
            #a[i] == 0のとき未満不確定はありえない
            dp[i][j][1] = 0
        elif j == 0 and a[i] == 0:
            #未満確定で0以外がj個のとき、0の1個
            dp[i][j][0] = dp[i-1][j][0] * 1
            #未満不確定で0以外がj個のとき、0==a[i]の1個
            dp[i][j][1] = dp[i-1][j][1] * 1
            

#print(dp)
print(dp[l-1][k][0] + dp[l-1][k][1])

Measured memory_bytes: 3192
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
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(){
  int N,P[4];
  cin>>N;
  REP(i,4) P[i]=0;
  string S[N];
  REP(i,N){
    cin>>S[i];
    if(S[i]=="AC") P[0]++;
    if(S[i]=="WA") P[1]++;
    if(S[i]=="TLE") P[2]++;
    if(S[i]=="RE") P[3]++;
  }
  
  cout<<"AC x "<<P[0]<<endl;
  cout<<"WA x "<<P[1]<<endl;
  cout<<"TLE x "<<P[2]<<endl;
  cout<<"RE x "<<P[3]<<endl;
  return 0;
}

Measured memory_bytes: 6748
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+100;
char s[maxn];
int main()
{
    while (scanf("%s",s)!=EOF)
    {
        int l=strlen(s);
        int ans=l;
        for (int i=1;i<l;i++)
            if (s[i-1] != s[i])
                ans=min(ans,max(i,l-i));
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

int main()
{
    string S;
    ll K;
    cin >> S >> K;
    char before = '*';
    if (S[0] != S[S.length() -1]){
        ll s_total = 0;
        ll continues = 0;
        for(int i = 0;i < S.length();i++){
            if (S[i] != before){
                s_total += continues/2;
                continues = 1;
            }else{
                continues++;
            }
            before = S[i];
        }
        s_total += continues/2;
        // cout << s_total << endl;
        cout << s_total * K  << endl;
    }else{
        vector<ll> continues;
        ll current_continue = 0;
        for(int i = 0;i < S.length();i++){
            if (S[i] != before){
                if (current_continue != 0){
                    continues.push_back(current_continue);
                }
                current_continue = 1;
            }else{
                current_continue++;
            }
            before = S[i];
        }
        continues.push_back(current_continue);
        // cout << continues.size() << endl;
        if (continues.size() == 1){
            cout << (continues[0]*K)/2 << endl;
        }else{
            ll first_total = 0;
            ll other_total = 0;
            for(int i = 0;i<continues.size()-1;i++){
                if (i==0){
                    first_total += continues[0]/2;
                    first_total += continues[continues.size()-1]/2;
                    other_total += (continues[0] + continues[continues.size()-1])/2;
                }else{
                    first_total += continues[i]/2;
                    other_total += continues[i]/2;
                }
            }
            // cout << first_total << endl;
            // cout << other_total << endl;
            cout << first_total + other_total * (K - 1) << endl;
        }
    }
   return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

int xt[4] = {0,1,0,-1};
int yt[4] = {1,0,-1,0};

struct pos
{
    int x,y,len;

    pos(int _x, int _y, int _len){
        x = _x;
        y = _y;
        len = _len;
    }

};

int main(void)
{
    int h,w;
    cin >>h >>w;
    vector<vector<int> > stage(h, vector<int>(w, -1));
    queue<pos> q;
    for(int i = 0; i < h; i++){
        string tmp;
        cin >>tmp;
        for(int j = 0 ; j < w; j++){
            if(tmp[j] == '#'){
                stage[i][j] = 0;
                q.push(pos(j, i, 0));
            }
        }
    }

    int maxlen = 0;
    while(!q.empty()){
        pos current = q.front();
        q.pop();
        maxlen = max(maxlen, current.len);
        for(int i = 0; i < 4; i++){
            int nx = current.x + xt[i];
            int ny = current.y + yt[i];
            if(nx < 0 || nx >= w || ny < 0 || ny >= h){
                continue;
            }
            if(stage[ny][nx] == -1){
                q.push(pos(nx, ny, current.len + 1));
                stage[ny][nx] = current.len +1;
            }
        }
    }

    printf("%d\n", maxlen);

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int lb = 0;
    int rw = count(s.begin(), s.end(), '.');
    int ans = numeric_limits<int>::max();
    for (int i = 0; i <= n; i++) {
        ans = min(ans, lb + rw);
        if (i < n) {
            lb += s[i] == '#';
            rw -= s[i] == '.';
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 644
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines

# 遅延評価で加えてあげるだけ

N,Q = map(int,readline().split())
lines = readlines()
AB = (tuple(int(x) for x in line.split()) for line in lines[:N-1])
PX = (tuple(int(x) for x in line.split()) for line in lines[-Q:])

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

par = [None] * (N+1)
q = [1]
while q:
    x = q.pop()
    for y in graph[x]:
        if y == par[x]:
            continue
        value[y] += value[x]
        q.append(y)
        par[y] = x

answer = ' '.join(map(str,value[1:]))
print(answer)

Measured memory_bytes: 95468
from math import sqrt
n = int(input())
p = 0

for i in range(n):
    x = int(input())
    ad = 1
    if x>2 and x%2==0:
        ad = 0
    else:
        j=3
        while j < (int(sqrt(x))+1):
            if x%j == 0:
                ad = 0
                break
            else:
                j += 2
    p += ad



print(p)


Measured memory_bytes: 5672
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int a,b; cin>>a>>b;

  int ans=0;
  rep(i,b-a-1){
    ans+=i+1;
  }
  ans-=a;

  cout<< ans<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
//#include<algorithm>
//#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int i,j,k,n,m,t,x,y;
  cin>>i;
  if(i>=30)
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 3592
// Problem : D - Knight
// Contest : AtCoder - AtCoder Beginner Contest 145
// URL : https://atcoder.jp/contests/abc145/tasks/abc145_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
    return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
    mem(isprime,true);
    for(ll p=2;p*p<=n;p++)
    {
        if(isprime[p]==true)
        {
            for(ll i=p*p;i<=n;i+=p)
                isprime[i]=false;
        }
    }
}
ll lcm(ll a,ll b)
{
    return (a/__gcd(a,b))*b;
}
ll power(ll a,ll n)
{
	ll res=1;
	a=a%MOD;
	while(n>0)
	{
		if(n&1)
			res=(res*a)%MOD;
		n=n/2;
		a=(a*a)%MOD;
	}
	return res;
}
vector<ll> fact;
void findfactorial(ll n)
{
	fact.resize(n+1);
	fact[0]=fact[1]=1;
	for(ll i=2;i<=n;i++)
		fact[i]=(fact[i-1]*i)%MOD;
}
ll modInverse(ll n)
{
	return power(n,MOD-2);
}
ll ncrmod(ll n,ll r)
{
	return ((((fact[n]*modInverse(fact[n-r]))%MOD)*modInverse(fact[r]))%MOD);
}
void solve()
{
    ll x,y;
    cin>>x>>y;
    if((x+y)%3!=0)
    {
    	cout<<"0";
    	return;
    }
    ll n=(2*y-x)/3;
    ll m=(2*x - y)/3;
    //cout<<n<<" "<<m<<" ";
    if(n<0 or m<0)
    {
    	cout<<"0";
    	return ;
    }
    findfactorial(x+y);
    cout<<ncrmod(n+m,n);
}
int main()
{
    ll inpoup = 0;
    if(inpoup==1)
    {
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
    }
    IOS
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 15872
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
#include <complex>
using namespace std;

const double EPS = 1e-9;
const double PI = 3.14159265359;

typedef complex<double> P;

double Cross(P a, P b){
	return a.real()*b.imag() - b.real()*a.imag();
}

int main(){
	double x, y;
	while(~scanf("%lf,%lf", &x, &y)){
		vector<P> v;
		v.push_back(P(x, y));
		for(int i = 1; i < 3; i++){
			scanf(",%lf,%lf", &x, &y);
			v.push_back(P(x, y));
		}
		double d = 2*Cross(v[1]-v[0], v[2]-v[0])/abs(v[1]-v[0]);
//		cout << "d:" << d <<endl;
		P r = P(0, -1)*(v[1]-v[0]);
		r /= abs(r);
		P p = v[2]+d*r;
		printf("%lf %lf\n", p.real(), p.imag());
	}

	return 0;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll A, B;
  cin >> A >> B;
  if (A % B == 0) {
    COUT(0);
  } else {
    COUT(1);
  }
  return 0;
}

Measured memory_bytes: 3656