akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define ALL(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;

double total = 0;

void perm(vector<pair<double, double>>& towns, pair<double, double>& prev, 
							int seen, int i, int n, double cur) {
	if(i == n) {
		//~ cout << cur << '\n';
		total += cur;
	} else {
		for(int j = 0; j < n; j++) {
			if(!(seen & (1<<j))) {
				seen ^= (1<<j);
				if(i > 0) cur += sqrt((towns[j].first-prev.first)*(towns[j].first-prev.first) + 
							(towns[j].second-prev.second)*(towns[j].second-prev.second));
				auto tmp = prev;
				prev = towns[j];
				perm(towns, prev, seen, i+1, n, cur); 
				prev = tmp;
				seen ^= (1<<j);
				if(i > 0) cur -= sqrt((towns[j].first-prev.first)*(towns[j].first-prev.first) + 
							(towns[j].second-prev.second)*(towns[j].second-prev.second));
			}
		}
		
	}
}

int fact(int n) {
	int x = 1;
	int f = 1;
	while(x <= n) {
		f *= x++;
	}
	return f;
}

void solve(void) {
	cout << setprecision(12);
	int n;
	cin >> n;
	vector<pair<double, double>> towns;
	for(int i = 0; i < n; i++) {
		double x, y;
		cin >> x >> y;
		towns.emplace_back(x, y);
	}
	pair<double, double> prev = make_pair(0, 0);
	perm(towns, prev, 0, 0, n, 0);
	//~ cout << fact(n) << '\n';
	total /= fact(n);
	cout << total << '\n';

}

int main(void) {

	solve();

	return 0;
}


Measured memory_bytes: 256
N = int ( input().strip() ) ;

dic = {} ;
r = -1 ;
for x in range ( N ) :
	s = input().strip() ;
	d = dic[s] if s in dic else 0;
	dic[s] = d + 1 ;

m = max( dic.values() ) ;
L = [] ;
for key in dic :
	if dic[key] != m : continue ;
	L.append( key ) ;
L.sort() ; 
for x in L : 
	print ( x ) ;

Measured memory_bytes: 32096
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

vector<vector<int>> graph;
vector<int> parent;

int main() {
    int n, m;
    cin >> n >> m;
    graph.resize(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b, a--, b--;
        graph[a].push_back(b), graph[b].push_back(a);
    }

    parent.resize(n);
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int now = que.front();
        que.pop();
        for (auto next:graph[now]) {
            if (parent[next] != 0)continue;
            parent[next] = now + 1;
            que.push(next);
        }
    }

    cout << "Yes" << endl;
    for (int i = 1; i < n; i++) cout << parent[i] << endl;
    return 0;
}

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

using namespace std;

int main(){

 long long int a, b, c, d;
 
 cin >> a >> b >> c >> d;
 
 long long int w, x, y, z, max;

  w = a * c;
  x = a * d;
  y = b * c;
  z = b * d;

  max = w;

 if( max < x ){
  max = x;
 }
 if( max < y ){
  max = y;
   }
 if( max < z ){
  max = z;
   }

 cout << max << endl;

 return 0;
}

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

int main() {
    
    int N;
    cin >> N;
    
    int ans = 0;
    
    while(N--)
    {
        int x;
        cin >> x;
        
        while(x % 2 == 0)
            x/= 2, ans++;
    }
    
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>



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

using namespace std;
int a,b,c,d;
int k1,k2;
string s;

int main(){
  cin >> a >> b >> c;
  if(a<=c&&c <= a+b) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}



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

int main() {
  // ここにプログラムを追記
  int N;
  cin >> N;
  vector<vector<int>> h(N,vector<int> (2));
  for(int i =0;i<N;i++){
    cin >> h.at(i).at(0) >> h.at(i).at(1);
  }
  int sum = 0;
  for(int i = 0; i<N; i++){
    sum +=h.at(i).at(1)-h.at(i).at(0)+1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int dp[3001][3001];
int main(){
  string s,t;cin>>s>>t;
  for(int i = 1; s.size() >= i; i++){
    for(int j = 1; t.size() >= j; j++){
      if(s[i-1]==t[j-1]){
        dp[i][j] = dp[i-1][j-1]+1;
      }else{
        dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
      }
    }
  }
  // for(int i = 0; s.size() >= i; i++){
  //   for(int j = 0; t.size() >= j; j++){
  //     cout << dp[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  string z = "";
  int mx = dp[s.size()][t.size()];
  for(int i = s.size(); 0 < i && mx!=0; i--){
    for(int j = t.size(); 0 < j; j--){
      if(dp[i][j] == dp[i-1][j]+1 && dp[i][j] == dp[i][j-1]+1 && mx==dp[i][j]){
        z.push_back(s[i-1]);
        mx--;
        i--;
        if(i==0)break;
      }
    }
  }
  reverse(z.begin(),z.end());
  cout << z << endl;
}

Measured memory_bytes: 35456
s = input().split()
N = int(s[0])
M = int(s[1])
C = int(s[2])

B = input().split()
inputs = [input().split() for i in range(N)]

answer = 0
for A in inputs:
  total = 0
  for i in range(M):
    total += int(A[i])*int(B[i])
    
  total += C
  if total > 0:
    answer += 1
    
print(answer)

Measured memory_bytes: 3064
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        ArrayList<Integer> A = new ArrayList<>();
        HashMap<Integer,Integer> count = new HashMap<>();
        for(int i=0; i<N; i++){
            int a = scanner.nextInt();
            A.add(a);
            count.putIfAbsent(a, 0);
            int current = count.get(a);
            count.put(a, current + 1);
        }
        long allpair = 0;
        for(int i:count.keySet()){
            int val = count.get(i);
            if(val>0){
                allpair += (long)val*((long)val-1)/2;
            }
        }
        for(int i=0; i<A.size(); i++){
            int num = A.get(i);
            if(count.get(num)>1){
                System.out.println(allpair - (count.get(num)-1));
            }else{
                System.out.println(allpair);
            }
        }
    }
}

Measured memory_bytes: 132104
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;


int main(){
  int n; cin>>n;
  string s; cin>>s;
  int c=0;
  for(int i=0;i<n-2;i++){
    if(s[i]=='A'){
      if(s[i+1]=='B'&&s[i+2]=='C')
      c++;
    }
  }
  cout<<c<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();

		int count = 0;
		for (int i = 100; i > 0; i--) {
			if(a%i == 0 && b%i == 0) {
				count ++;
				if(count == k) {
					System.out.println(i);
				}
			}
		}
	}

}


Measured memory_bytes: 22612
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;


template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

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

	priority_queue<ll> pq;
	rep(i, 0, N) {
		ll a;
		cin >> a;
		pq.push(a);
	}

	ll l_min = 1;
	ll l_max = pq.top();
	ll ans;

	while (l_min != l_max) {
		ans = (l_max - l_min) / 2 + l_min;
		priority_queue<ll> pq2 = pq;

		ll cnt = 0;
		while (cnt <= K && !pq2.empty() && ans < pq2.top()) {
			cnt += (pq2.top() - 1) / ans;
			pq2.pop();
		}

		if (cnt > K) {
			l_min = ans + 1;
		}
		else {
			l_max = ans;
		}
	}
	ans = l_min;
	cout << ans << endl;
}


Measured memory_bytes: 6348
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define ret0 return 0;
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main() {
    map <ll, ll> pcnt;
    map <ll, bool> done;
 
    ll n, m;
    cin >> n >> m;
    if (n>9 || m>9) {
        mes (-1);
        ret0;
    }
    
    
    mes (n*m);
}


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

#define LL long long

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    LL n, m, a[3]; cin >> n >> m;
    LL ans = 1e18;
    
    a[0] = (n / 3) * m;
    a[1] = ((n - n / 3) / 2) * m;
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = (m / 3) * n;
    a[1] = ((m - m / 3) / 2) * n;
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = (n / 3) * m;
    a[1] = ((n - n / 3)) * (m / 2);
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = (m / 3) * n;
    a[1] = ((m - m / 3)) * (n / 2);
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = ((n + 2) / 3) * m;
    a[1] = ((n - (n + 2) / 3) / 2) * m;
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = ((m + 2) / 3) * n;
    a[1] = ((m - (m + 2) / 3) / 2) * n;
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = ((n + 2) / 3) * m;
    a[1] = ((n - (n + 2) / 3)) * (m / 2);
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);

    a[0] = ((m + 2) / 3) * n;
    a[1] = ((m - (m + 2) / 3)) * (n / 2);
    a[2] = n * m - a[0] - a[1];
    sort(a, a + 3);
    ans = min(ans, a[2] - a[0]);
    cout << ans;
}

Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repR(i, n) for(int i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(int i = n; i >= 0; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;template<typename TypeInt>TypeInt G_C_D(TypeInt a, TypeInt b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename TypeInt>
TypeInt G_C_D(const std::vector<TypeInt> &list){TypeInt a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename TypeInt>TypeInt L_C_M(TypeInt a, TypeInt b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename TypeInt>TypeInt L_C_M(const std::vector<TypeInt> &list){TypeInt a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	int N;
	cin>>N;
	vector<int> a(N);
	FDS(i,N){
		cin>>a[i];
	}
	int sum=0;
	FDS(i,N){
		while(a[i]%2==0){
			sum++;
			a[i]/=2;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
ArrayDequeではpopとpushはStackと同じ操作になる
*/
//入力終了→Ctrl+D
import java.util.*;
import java.awt.*;
import java.awt.geom.Point2D;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int h=Integer.parseInt(sc.next());
        int w=Integer.parseInt(sc.next());
        int d=Integer.parseInt(sc.next());
        int[][] a=new int[h][w];
        int[] point=new int[90001];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                a[i][j]=Integer.parseInt(sc.next());
                point[a[i][j]]=i*w+j;
            }
        }
        long[] ds=new long[h*w+1];
        for (int i = 1; i <= h * w; i++) {
            if(i>d)ds[i]=ds[i-d]+abs(point[i]/w-point[i-d]/w)+abs(point[i]%w-point[i-d]%w);
        }
        int q=Integer.parseInt(sc.next());
        for (int i = 0; i < q; i++) {
            int l=Integer.parseInt(sc.next());
            int r=Integer.parseInt(sc.next());
            out.println(ds[r]-ds[l]);
        }
    }
}

Measured memory_bytes: 70436
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
//Tariquzzaman Faisal
//_Faisal101_
//IUT_CSE'19
//190041101
 
#include<iostream>
#include<stdio.h>
#include<vector>
#include<deque>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#include<cstring>
#include<climits>
#include<cmath>
#include<iterator>
#include<set>
#define fileOut freopen("out.txt","w",stdout)
#define fileIn freopen("in.txt","r",stdout)
#define testcases ll TC,T; cin >> TC; for(T=1; T<=TC; T++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define INFLL 9223372036854775807
#define INF 2147483647
#define pi acos(-1.0)
#define ll long long
#define endll printf("\n")
#define CASE printf("Case %lld: ",T)
#define ff first
#define ss second
#define mem(ara,n) memset(ara,n,sizeof ara)
#define ull unsigned long long
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mid3(a,b,c) min(max(a,b),max(b,c),max(a,b))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define endl '\n'
#define ld long double
 
 
using namespace std;


int main(){
    ll n;
    cin >> n;
    ll x, odds = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> x;
        if(x%2!=0){
            odds++;
        }
    }
    if(odds % 2 == 0){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3640
#pragma GCC optimize("Ofast","unroll-loops")
#pragma GCC push_options
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include <xmmintrin.h>
#include <immintrin.h>
using namespace::std;
__attribute__((constructor))void init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cdouble;
// typedef mp::cpp_int cint;
template<typename T>using pbds=__gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T>using pbds_map=__gnu_pbds::tree<T,T,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
template<typename T>using pqueue =__gnu_pbds::priority_queue<T, greater<T>,__gnu_pbds::rc_binomial_heap_tag>;
typedef long long lint;
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define MOD 1000000007LL
//#define MOD 998244353LL
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
template<typename T>inline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i<INF/2?i:"INF";f=1;}cout<<endl;}
template<typename T>inline void numout2(T t){for(auto i:t)numout(i);}
template<typename T>inline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}
template<typename T>inline void output2(T t){for(auto i:t)output(i);}
template<typename T>inline void _output(T t){bool f=0;for(lint i=0;i<t.size();i++){cout<<f?"":" "<<t[i];f=1;}cout<<endl;}
template<typename T>inline void _output2(T t){for(lint i=0;i<t.size();i++)output(t[i]);}
#define rep(i,n) for(lint i=0;i<lint(n);++i)
#define repi(i,a,b) for(lint i=lint(a);i<(lint)(b);++i)
#define rrep(i,n) for(lint i=lint(n)-1;i>=0;--i)
#define rrepi(i,a,b) for(lint i=lint(b)-1;i>=lint(a);--i)
#define irep(i) for(lint i=0;;++i)
#define all(n) begin(n),end(n)
#define dist(a,b,c,d) sqrt(pow(a-c,2)+pow(b-d,2))
inline lint gcd(lint A,lint B){return B?gcd(B,A%B):A;}
inline lint lcm(lint A,lint B){return A/gcd(A,B)*B;}
// inline cint cgcd(cint A,cint B){return B?cgcd(B,A%B):A;}
// inline cint clcm(cint A,cint B){return A/cgcd(A,B)*B;}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
const vector<lint> dx={1,0,-1,0,1,1,-1,-1};
const vector<lint> dy={0,1,0,-1,1,-1,1,-1};
#define SUM(v) accumulate(all(v),0LL)
auto call=[&](auto f,auto... args){return f(f,args...);};

int main(){
    lint x,a,b;
    cin>>x>>a>>b;
    if(b<=a){
        cout<<"delicious"<<endl;
    }else if(b<=x+a){
        cout<<"safe"<<endl;
    }else{
        cout<<"dangerous"<<endl;
    }
}

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

Measured memory_bytes: 600
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int a = inp.nextInt();
        int b = inp.nextInt();
        int c = inp.nextInt();
        if (a == b) System.out.println(c);
        else if (a == c) System.out.println(b);
        else System.out.println(a);
    }
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

int euclid(int a, int b)
{
    if (a < b)
        euclid(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int x, a, b;
    cin >> x >> a >> b;

    x -= a;
    while (x - b >= 0)
        x -= b;

    cout << x << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

int lcm(int x, int y){
  return x/__gcd(x, y)*y;
}

signed main() {
  int N, M;
  cin >> N >> M;

  string s, t;
  cin >> s >> t;

  int l = lcm(N, M);
  map<int, char> m;
  REP(i, N) m[l/N*i] = s[i];
  REP(i, M){
    if(m[l/M*i] != '\0'){
      if(m[l/M*i] != t[i]){
        cout << -1 << endl;
        return 0;
      }
    }
  }

  cout << l << endl;

  return 0;
}

Measured memory_bytes: 10880
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

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

    int N,A,B;
    cin >> N >> A >> B;
    cout << min(A,B) << endl;
    if(N-A-B >= 0) cout << 0 << endl;
    else cout << A+B-N << endl;

    return 0;
}*/

/*
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    string A,B,C;
    cin >> N >> A >> B >> C;
    int ans = 0;
    for(int i=0; i<N; i++){
        if(A[i] == B[i] && A[i] != C[i]) ans++;
        if(A[i] == C[i] && A[i] != B[i]) ans++;
        if(B[i] == C[i] && A[i] != B[i]) ans++;
        if(A[i] != B[i] && B[i] != C[i] && C[i] != A[i]) ans += 2;
        //cout << ans << " " << i << endl;
    }
    cout << ans << endl;
    
    return 0;
}*/




int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    LL A[100000], B[100000];
    vector<pair<LL,int> > tmp;
    for(int i=0; i<N; i++){
        cin >> A[i] >> B[i];
        tmp.push_back(MP(A[i]+B[i],i));
    }
    sort(tmp.begin(), tmp.end());
    reverse(tmp.begin(), tmp.end());

    LL p1 = 0;
    LL p2 = 0;
    for(int i=0; i<N; i++){
        if(i%2 == 0) p1 += A[tmp[i].second];
        else p2 += B[tmp[i].second];
    }
    cout << p1 - p2 << endl;
    
    return 0;
}


/*

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    
    return 0;
}
*/

/*

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    
    return 0;
}
*/

/*

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    
    return 0;
}
*/

Measured memory_bytes: 3568
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    string s;
    cin >> s;
    rep(i, s.size() - 8) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 3592
#include<stdio.h>
typedef long long ll;
int par[100001];
int rank[100001];
ll num[100001];
ll ans = 0;

void init(int n){
	for(int i=0; i<n; i++){
		par[i] = i;
		rank[i] = 0;
		num[i] = 1;
	}
}

int find(int x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(int x, int y){
	x = find(x);
	y = find(y);
	if(x == y){return;}
	ans = ans - (num[x]*(num[x]-1))/2 - (num[y]*(num[y]-1))/2; 
	if(rank[x] < rank[y]){
		par[x] = y;
		num[x] += num[y];
		ans += (num[x]*(num[x]-1))/2;
		num[y] = num[x];
	}else{
		par[y] = x;
		num[x] += num[y];
		ans += (num[x]*(num[x]-1))/2;
		num[y] = num[x];
		if(rank[x] == rank[y]){rank[x]++;}
	}
}

int main(){
	ll N, M;
	scanf("%lld%lld", &N, &M);
	int A[M], B[M];
	for(int i=0; i<M; i++) scanf("%d%d", &A[i], &B[i]);
	init(N);
	ll ANS[M];
	ll aa = (N*(N-1))/2;
	ANS[M-1] = aa;
	for(int i=M-2; i>=0; i--){
		unite(A[i+1]-1, B[i+1]-1);
		ANS[i] = aa - ans;
	}
	for(int i=0; i<M; i++) printf("%lld\n", ANS[i]);
	return 0;
}

Measured memory_bytes: 4352
U = 10**6
MOD = 10**9+7
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z *= fact_inv[n-k]
    z %= MOD
    return z

n, k = map(int, input().split())
if k+1 < n:
  ans = 0
  for i in range(k+1, n):
    ans += comb(n, i) * comb(n-1, i)
    ans %= MOD
  ans = comb(2*n-1, n) - ans
  ans %= MOD
else:
  ans = comb(2*n-1, n)
print(ans)

Measured memory_bytes: 56412
string = input()

def jadge_humiyasui(string):
    label1 = True
    label2 = True

    for i, str in enumerate(string):
        if i % 2 == 0:
            if str not in ['R', 'U', 'D']:
                label1 = False
        else:
            if str not in ['L', 'U', 'D']:
                label2 = False

    if label1 & label2:
        print('Yes')
    else:
        print('No')

jadge_humiyasui(string)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int n,cnt=0;
    cin>>n;
    cin>>s;
    for(int i=0;i<n-2;i++)
    {
        if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
            cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

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


Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <string>
using namespace std; 
int main(){
  int a,b,c,d;
  d = 1;
  cin >>a>>b>>c;
  d = max({a,b,c});
  if(d == a){
    if(d == b+c){
      cout << "Yes";
    }else{
      cout << "No";
    }
  }else if(d == b){
    if(d == a+c){
      cout << "Yes";
    }else{
      cout << "No";
    }
  }else if(d == c){
    if(d == a+b){
      cout << "Yes";
    }else{
      cout << "No";
    }
  }
}

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

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define pla(i,a,n) for(i=0;i<n;i++){printf("%lld%c", a[i],i==n-1[' ','\n']);}
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 200006


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/
ll a[MX];
ll n;
ll f(ll x,ll y,ll z)
{
    return (x*x)+(y*y)+(z*z)+(x*y)+(y*z)+(z*x);
}
int main()
{
    //Fin;
    int test, tc=0, i, j,k;
    ll m,t,o,e;
    //scanf("%d", &test);
    test=1;
    ll x=0,y=0,z=0;
    n=10000;
    for(i=1;i<n;i++)
    for(j=1;j<n;j++)
    for(k=1;k<n;k++)
    {
        m=f(i,j,k);
        if(m>n)break;
        a[m]++;
    }
    while(test--)
    {
        cin>>n;
        for(i=1;i<=n;i++)
        {
            o=0;
            o=a[i];
            cout<<o<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3660
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>> A(m);
    for(auto &I:A){
        ll k;
        cin>>k;
        I.resize(k);
        for(auto &T:I){
            cin>>T;
            T--;
        }
    }
    vector<ll> P(m);
    for(auto &I:P){cin>>I;}
    ll ans=0;
    for(ll i=0;i<(1LL<<n);i++){
        bool jd=true;
        for(int j=0;j<m;j++){
            ll cnt=0;
            for(auto &I:A[j]){if(i>>I&1){cnt++;}}
            if(cnt%2!=P[j]){jd=false;}
        }
        if(jd){ans++;}
    }
    cout<<ans<<endl;
    
    
    return 0;
}


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

#define     F       first
#define     S       second
typedef pair<int, int>  pi;
typedef long long       ll;


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

    int n, r;
    cin >> n >> r;
    if (n>=10)      cout << r;
    else            cout << r+100*(10-n);

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int N,a[100001];
	scanf("%d",&N);
	int i=0;
	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	int s=0;
	for(i=0;i<N;i++){
		if(a[a[i]-1]==(i+1)){
			s++;
		}
	}
	printf("%d\n",s/2);
	return 0;
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl

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

    string s;
    cin >> s;

    if(s=="ABC") print("ARC");
    else print("ABC");

    return 0;
    
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int N; cin >> N;
	vector<string> U(N); rep(i, 0, N) { cin >> U[i]; }
	int M; cin >> M;
	vector<string> T(M); 
	bool isopened = false;
	rep(i, 0, M) {
		cin >> T[i];
		if (count(U.begin(), U.end(), T[i])) {
			if (isopened)cout << "Closed by "+T[i] << endl;
			else cout << "Opened by " + T[i] << endl;
			isopened = !isopened;
		}
		else
			cout << "Unknown " + T[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3220
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int p[200010];
vector<int> T[200010];
int ans[200010];

void dfs(int v, int parent, int point) {
    point += p[v];
    ans[v] += point;
    for(auto to : T[v]) {
        if (to != parent) {
            dfs(to, v, point);
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int Q; cin >> Q;
    rep(i, N - 1) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        T[s].push_back(t);
        T[t].push_back(s);
    }
    rep(i, Q) {
        int P, x;
        cin >> P >> x;
        P--;
        p[P] += x;
    }
    dfs(0, -1, 0);
    rep(i, N) {
        if (i != 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;


    return 0;
}


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

int main() {
    int A,B,C;
    cin >> A >> B >> C;
    if(A==B && B!=C)
        cout << C;
    else if(B==C && C!=A)
        cout << A;
    else
        cout << B;
    cout << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
long int N;

long int lyuka(int num)
{
    long int *dp=new long int[87];
    dp[0]=2;
    dp[1]=1;
    for(int i=2;i<=num;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[num];
}

int main(int argc, char const *argv[])
{
    cin >> N;
    long int ans = lyuka(N);
    cout << ans << endl;
    return 0;
}


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

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

LL Gcd(LL a, LL b) {
  if (a < b) {
    return Gcd(b,a);
  }
  if (b == 0) {
    return a;
  }
  else {
    return Gcd(b,a%b);
  }
}
 
LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}

int main(){
  VI A(3);
  cin >> A[0] >> A[1] >> A[2];
  SORT(A);
  
  if(A[0] == 5 && A[1] == 5 && A[2] == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  return 0;
}
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define ld long double
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};
int main(){
  ll n,m;
  cin >> n >> m;
  ll ans[m+1];
  ans[m]=0;
  ll a[m];
  ll b[m];
  rep(i,m)cin >> a[i] >> b[i];
  UnionFind k(n);
  rep(i,m){
    ll c=a[m-1-i],d=b[m-1-i];
    c--;
    d--;
    if(k.findSet(c,d)){
      ans[m-1-i]=ans[m-i];
      continue;
    }
    else{
      ll o=k.size(c),p=k.size(d);
      ans[m-i-1]=ans[m-i]+o*p;
      k.unionSet(c,d);
    }
  }
  rep(i,m)cout << n*(n-1)/2-ans[i+1] << endl;
}

Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void) {
	int n, k;
	cin >> n >> k;
	vector<int>l(n);
	for (int i = 0; i < n; i++)cin >> l[i];
	sort(l.begin(), l.end(), greater<int>());
	int sum = 0;
	for (int i = 0; i < k; i++) {
		sum += l[i];
	}
	cout << sum;;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define rep(i, n) FOR(i, 0, n)
#define repi(i, n) FOR(i, 1, n + 1)
#define pp(v) cerr << #v "=" << (v) << endl;
#define ppa(v) cerr << "- " << #v << endl; rep(i,v.size()) cerr << #v << "[" << i << "] = " << v[i] << endl;
#define div_ceil(a,b) ((a) + ((b) - 1)) / (b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define INF 0x3f3f3f3f
#define LLINF 1000111000111000111LL
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;

int main() {
  int n;cin>>n;
  string s,t;cin>>s>>t;
  rep(i,n) cout << s[i] << t[i];
  cout << endl;
  // int a,b;cin>>a>>b;
  // int ans = 6 - a - b;
  // cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class A {
    string s;
    public A(string s){
        this.s = s;
    }
    public int run(){
        Stack<char> st = new Stack<char>();
        foreach(char e in s){
            switch(e){
                case 'S':
                    st.Push(e);
                    break;
                case 'T':
                    if(st.Count != 0 && st.Peek()=='S'){
                        st.Pop();
                    } else {
                        st.Push(e);
                    }
                    break;
                default :
                   st.Push(e);
                   break;
            }
        }
        
        return st.Count;
    }
}



class Program {
    static void Main(string[]  args){
        A a = new A(Console.ReadLine());
        Console.WriteLine(a.run());
    }
}

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

int main()
{
    unordered_map<char, int> mp;
    string s;
    cin >> s;
    for (auto c : s)
    {
        mp[c]++;
    }

    for (auto pair : mp)
    {
        if (pair.second % 2 == 1)
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

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

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

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

//素因数分解
template <class T>
map<T,T> prime_factor(T x){
    map<T,T> ans;
    for(T i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            ans[i]++;
        }
    }
    if (x!=1){
        ans[x]=1;
    }
    return ans;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    map<ll,ll> ret=prime_factor(n);
    ll ans=0;
    for(auto itr:ret){
        ll num=itr.se;
        ll cnt=0;
        rep(i,1000){
            if(i*(i+1)/2<=num){
                cnt=i;
            }
        }
        ans+=cnt;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int64_t x; 
  cin >> x;
  
  int64_t happ = 0; 
  
  int64_t coinA = x / 500;
  int64_t coinB = (x - coinA * 500) / 5;
  
  happ = coinA * 1000 + coinB * 5;

  cout << happ << endl;
  
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] p = new int[n];
        for(int i = 0; i < n; i++) p[i] = scan.nextInt();
        int pa = 0;
        int pb = 0;
        int pc = 0;
        for(int i = 0; i < n; i++){
            if(p[i] <= a) pa++;
            else if(p[i] <= b) pb++;
            else pc++;
        }
        System.out.println(Math.min(Math.min(pa, pb), pc));
        scan.close();
    }
}


Measured memory_bytes: 27232
M = 10**9 + 7
a = [1] + [0] * 12
p = 1
for c in reversed(input()):
    if c == '?':
        b = a[:]
        for j in range(-p, -p * 10, -p):
            j %= 13
            a = [sum(x) % M for x in zip(a, b[j:] + b[:j])]
    elif c > '0':
        j = -p * int(c) % 13
        a = a[j:] + a[:j]
    p = p * 10 % 13
print(a[5])


Measured memory_bytes: 45148
import java.util.*;

public class Main {

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

    int sum = a1+a2+a3;

    if (sum >= 22) {
      System.out.println("bust");
    } else {
      System.out.println("win");
    }


  }

}


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

int main(){
    int n;
    cin>>n;
    int a[n], b[n], c[n], dp[3][n];
    for (int i=0; i<n; i++)
        cin>>a[i]>>b[i]>>c[i];
    dp[0][0] = a[0];
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    for (int i=1; i<n; i++){
        dp[0][i] = a[i] + max(dp[1][i-1], dp[2][i-1]);
        dp[1][i] = b[i] + max(dp[0][i-1], dp[2][i-1]);
        dp[2][i] = c[i] + max(dp[0][i-1], dp[1][i-1]);
    }
    cout<<max(dp[0][n-1], max(dp[1][n-1], dp[2][n-1]));
    return 0;
}

Measured memory_bytes: 2560
K = int(input())
S = list(input())
S1 = []
L = len(S)

if(K >= L):
    print(''.join(S))
else :
    S.insert(K,'.')
    S.insert(K+1,'.')
    S.insert(K+2,'.')
    print(''.join(S[0:K+3]))

Measured memory_bytes: 9220
l = input()
m = input()
z = l.split(" ")
M = int(z[1])
F = m.split(" ")
X = []
amount=0
for item in F:
  votes = int(item)
  amount = amount + votes
  X.append(votes)
X.sort(reverse=True)
C = amount/(4*M)
if X[M-1]<C:
  print("No")
else:
  print("Yes")


Measured memory_bytes: 3064
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())
ans = 0

for a in range(n):
  a += 1
  for b in range(n):
    b+=1
    for c in range(n):
      c+=1
      ans += gcd(a, b, c)

print(ans)

Measured memory_bytes: 69692