akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize "O3"
#define _USE_MATH_DEFINES
#define FAST ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#include <bits/stdc++.h>
#define Loop(x, l, r) for(int x = l; x < r; ++x)
#define LoopR(x, l, r) for(int x = r-1; x >= l; --x)
#define all(x) x.begin(), x.end()
#define Kill(x) return cout << x << '\n', 0
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

const int N = 1'000'010;
int a[N];
bool cnt[N] = {};
int n;

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

bool factor(int x)
{
    if(!(x & 1))
    {
        if(cnt[2])
            return 0;
        x >>= __builtin_ctz(x);
        cnt[2] = true;
    }
    for(int d = 3; d * d <= x; d += 2)
    {
        if(x % d)
            continue;
        if(cnt[d])
            return 0;
        cnt[d] = true;
        while(x % d == 0)
            x /= d;
    }
    if(x > 1)
    {
        if(cnt[x])
            return 0;
        cnt[x] = true;
    }
    return 1;
}

int main()
{
    FAST;
    int gcd = 0;
    cin >> n;
    Loop(i,0,n)
    {
        cin >> a[i];
        gcd = ::gcd(a[i], gcd);
    }
    if(gcd > 1)
        Kill("not coprime");
    Loop(i,0,n)
        if(!factor(a[i]))
            Kill("setwise coprime");
    Kill("pairwise coprime");
}


Measured memory_bytes: 7560
#include<bits/stdc++.h>
#define N 100005
using namespace std;
struct edge{
    int t,type,next;
}e[N*2];int ecnt,head[N],du[N];
void addedge(int f,int t){
    e[++ecnt]=(edge){t,1,head[f]};head[f]=ecnt;du[f]++;
    e[++ecnt]=(edge){f,-1,head[t]};head[t]=ecnt;
}
int cor[N],num[6];
void DFS(int u,int col){
    if(cor[u]!=-1){
        if(cor[u]!=col) num[0]=-1e9;
        return;
    }
    cor[u]=col;num[col]++;num[3]++;num[4]+=du[u];
    for(int i=head[u];i;i=e[i].next)
        DFS(e[i].t,(col+e[i].type+3)%3);
}
int n,m;
int main(){
    memset(cor,-1,sizeof(cor));
    scanf("%d%d",&n,&m);
    for(int i=1,f,t;i<=m;i++) scanf("%d%d",&f,&t),addedge(f,t);
    long long ans=0;
    for(int i=1;i<=n;i++)
        if(cor[i]==-1){
            memset(num,0,sizeof(num));
            DFS(i,0);
            if(num[0]<0) ans+=1LL*num[3]*num[3];
            else if(num[0]==0||num[1]==0||num[2]==0) ans+=num[4];
            else ans+=num[0]*1LL*num[1]+num[1]*1LL*num[2]+num[2]*1LL*num[0];
        }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6912
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A, reverse=True)
if B[0]==B[1]:
    for i in range(N):
        print(B[0])
else:
    for i in range(N):
        if A[i] == B[0]:
            print(B[1])
        else:
            print(B[0])

Measured memory_bytes: 14112
import java.util.Scanner;
import java.util.Stack;

public class Main{ // algorithm for reverse polish notation

	
	
	
	  
    public static void main(String[] args) {
    	 Scanner sc = new Scanner(System.in);
         String ex = sc.nextLine();
         String[] k = ex.split(" ");
    String[] polish = k;
    String testCase = "";
    int testSize = polish.length; // length of the test case
    int number1=0;
    int number2=0;
    Stack<Integer> stack = new Stack<Integer>();
   
    for(int i=0; i<testSize; i++){
   	 testCase = polish[i];

        
        if(testCase.equals("+") || testCase.equals("-") || testCase.equals("*") || testCase.equals("/")) {
            number2 = (int) stack.pop();
            number1 = (int) stack.pop();
            
            switch(testCase){
            case "+" :
                stack.push(number1+number2); // plus
                break;
            case "-" :
                stack.push(number1-number2); // minus
                break;
            case "*" :
                stack.push(number1*number2); // multiplication
                break;
            case "/" :
                stack.push(number1/number2); // division
                break;
            }
        }else{
            stack.push(Integer.parseInt(testCase));
        }
        
        
          
    }
    System.out.println(stack.pop());
    
  
}
    	
    	
    
    	
          
           
            
            
        
        
       



}



Measured memory_bytes: 26248
#include <bits/stdc++.h>
using namespace std;
#define all(arr) arr.begin(), arr.end() 
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int n;
string s, ans;

int main(){
	IOS
	cin >> n >> s;
	for(int i=0;i<n;i++){
		if(s[i]!=s[i-1]){
			ans+=s[i];
		}
	}
	cout << ans.length() << '\n';
}


Measured memory_bytes: 3736
#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define vint vector<int>
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define pb() push_back()
#define mod 100000007
#define elif else if
#define str string
//main
signed main(){
  int N,M,O,Q,count=0,count2=0,count3=0;
  cin>>N;
  str S;
  char a='0';
  cin>>S;
  rep(0,S.size()){
    if(a!=S[i]){
      count+=1;
      a=S[i];
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n;i>=0;i--)
#define INF 100000005
#define MAX 100001
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
//__gcd(a,b), __builtin_popcount(a);

pair<int,int> a[1001], ans;
int b[1001], c[1001];
int main(){
	int n, m, t;
	ans.se = 0;
	scanf("%d%d", &n, &m);
	rrep(i,n){
		scanf("%d", &t);
		a[i].fi = t;
		a[i].se = i;
	}
	rrep(i,m)scanf("%d", &b[i]);
	
	for(int i = 1;i <= m;i++){
		t = INF;
		rrep(j,n)if(a[j].fi <= b[i])t = min(t, a[j].se);
		c[t]++;
		if(c[t] > ans.se){
			ans.fi = t;
			ans.se = c[t];
		}
	}
	printf("%d\n", ans.fi);
	return 0;
}

Measured memory_bytes: 3200
n = int(input())
x = [0]*100001
a = list(map(int,input().split()))
m = 0
ma = 0
for i in range(n):
    x[a[i]]+=1
for i in range(100001-2):
    m=x[i]+x[i+1]+x[i+2]
    if m>ma:
        ma=m
print(ma)


Measured memory_bytes: 14860
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

struct UnionFind {
    vector<ll> par, rank,
        cnt;  // par[i]:iの親の番号,rank[r]:rを根とする木の高さ,cnt[r]:rを根とする木の要素数

    UnionFind(ll N) {  //全て根として初期化
        for (ll i = 0; i < N; i++) par.push_back(i);
        rank.assign(N, 0);
        cnt.assign(N, 1);
    }

    ll root(ll x) {  // xの根を返す
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) {  // xの木とyの木を併合
        ll rx = root(x);
        ll ry = root(y);
        if (rx == ry) return;

        if (rank[rx] < rank[ry]) {
            par[rx] = ry;
            cnt[ry] += cnt[rx];
        } else {
            par[ry] = rx;
            cnt[rx] += cnt[ry];
            if (rank[x] == rank[y]) rank[rx]++;
        }
    }

    ll tsize(ll x) {  //　xの木の要素数を返す
        ll rx = root(x);
        return cnt[rx];
    }

    bool same(ll x, ll y) {  // xとyが同一の木に存在するかを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind tree(N);
    vector<int> block[N], frend[N];
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        A--, B--;
        frend[A].push_back(B);
        frend[B].push_back(A);
        tree.unite(A, B);
    }
    for (int i = 0; i < K; i++) {
        int C, D;
        cin >> C >> D;
        C--, D--;
        block[C].push_back(D);
        block[D].push_back(C);
    }
    for (int i = 0; i < N; i++) {
        int cnt = 0;
        cnt += tree.tsize(i);
        for (int j = 0; j < block[i].size(); j++) {
            if (tree.same(i, block[i][j])) cnt--;
        }
        cnt -= 1 + frend[i].size();
        cout << cnt << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 14196
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>

using namespace std;

int main() {
    ios :: sync_with_stdio(false);
    int n, c[502], s[502], f[502], ans;
    int i, j;
    cin>>n;
    for(i=1; i<n; ++i) {
        cin>>c[i]>>s[i]>>f[i];
    }
    for(i=1; i<n; ++i) {
        ans=0;
        for(j=i; j<n; ++j){
            if(ans<s[j]) {
                ans = s[j];
            }
            if(ans%f[j]) {
                ans += f[j] - ans % f[j];
            }
            ans += c[j];
        }
        cout<<ans<<endl;
    }
    cout<<0;
    return 0;
}

Measured memory_bytes: 256
while 1:
    n = int(raw_input())
    if n == 0: break
    S = [list(raw_input()) for i in xrange(n)]

    for y in xrange(n):
        for x in range(len(S[y])):     
            if S[y][x] == ".": S[y][x] = " "
            else:
                if x > 0:
                    S[y][x-1] = "+"
                    t = y-1
                    while S[t][x-1] == " ":
                        S[t][x-1] = "|"
                        t -= 1
                break
    for s in S: print "".join(s)

Measured memory_bytes: 13972
import java.io.PrintStream;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();
		sc.close();
		long ans = 0;
		long step = 1;
		while (h != 1) {
			h /= 2;
			step++;
		}
		System.out.println((long) Math.pow(2, step) - 1);
	}

	public static int arrayMax(int[] array) {
		int ans = Integer.MIN_VALUE;
		for (int i = 0; i < array.length; i++) {
			if (array[i] > ans)
				ans = array[i];
		}
		return ans;
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static Integer[] arrayInteger(Scanner sc, int n) {
		Integer[] array = new Integer[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}

Measured memory_bytes: 22612
#include <stdio.h>

#define LENGTH 100

int main(void) {
  int x1 = 1;
  int x2 = 2;
  int x3 = 3;
  int x4 = 4;
  int x5 = 5;
  char input[LENGTH];
  //while (1) {
    fgets(input, LENGTH-1, stdin);
    sscanf(input, "%d %d %d %d %d", &x1, &x2, &x3, &x4, &x5);
    int n = 0;
    if (x1 == 0) n = 1;
    else if (x2 == 0) n = 2;
    else if (x3 == 0) n = 3;
    else if (x4 == 0) n = 4;
    else n = 5;
    printf("%d\n", n);
//  }
  return 0;

}


Measured memory_bytes: 2064
import math
N,M = map(int, input().split())
a = []
for i in range(N):
  a.append(input().split())

cnt=0
for i in range(N):
  for j in range(N-i-1):
    s=0
    for k in range(M):
      s += pow((int(a[i][k])-int(a[i+j+1][k])),2)
    c=1
    
    while(True):
      if pow(c,2) == s:
        cnt += 1
        break
      elif pow(c,2) > s:
        break
      c+=1
  
  
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath> //abs();
using namespace std;

int main(void)
{
    long long int a,b,c,d,i,j,k,n,x[10];
    char C1,C2;
    string s;

    cin >> x[0] >> x[1] >> x[2];

    sort(x,x+3);

    if(x[2]==x[0]+x[1]) cout << "Yes"; 
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define double long double
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define all(a) a.begin(),a.end()
#define sort(a) sort(all(a))
#define rsort(a) sort(all(a),greater<>())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
template<class T> inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef pair<int,int> P;
const long long MOD=1000000007;

vector<vector<ll>> dp(3010, vector<ll>(3010));
vector<vector<string>> dps(3010, vector<string>(3010));

// this code results TLE because operating string takes many time.
void solve_tld(std::string s, std::string t){
    for (ll i = 0; i < s.size(); i++) {
        for (ll j = 0; j < t.size(); j++) {
            if(s[i]==t[j]) {
              // dp[i][j+1] = dp[i][j] + 1;
              dps[i][j].push_back(s[i]);
              dps[i+1][j+1] += dps[i][j];
            }else{
              // dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
              if(dps[i+1][j].size() > dps[i][j+1].size()){
                dps[i+1][j+1] += dps[i+1][j];
              }else{
                dps[i+1][j+1] += dps[i][j+1];
              }
            }
        }
    }

    // for (ll i = 0; i <= s.size(); i++) {
    //     for (ll j = 0; j <= t.size(); j++) {
    //         // cout << dp[i][j] << " ";
    //         cout << dps[i][j] << " ";
    //     }
    //     cout << "\n";
    // }

    cout << dps[s.size()][t.size()] << "\n";
}

void solve(std::string s, std::string t){
    ll ss = s.size(), ts = t.size();
    // if(ss > ts) s.swap(t);
    for (ll i = 0; i < ss; i++) {
        for (ll j = 0; j < ts; j++) {
            if(s[i]==t[j]) {
              dp[i+1][j+1] = dp[i][j] + 1;
            }else{
              dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
            }
        }
    }

    // MOUT(dp,ss+1,ts+1);

    string str;
    ll i = ss, j = ts;
    while(i > 0 && j > 0){
        while(i > 0 && dp[i][j] == dp[i-1][j]) i--;
        while(j > 0 && dp[i][j] == dp[i][j-1]) j--;
        if(i>0) str += s[i-1];
        i--; j--;
    }

    // cout << str << "\n";
    reverse(all(str));
    cout << str << endl;
}

int main(){
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(s, t);
    return 0;
}


Measured memory_bytes: 142080
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int K, X; cin >> K >> X;
  if (500 * K >= X) cout << "Yes" << endl;
  else              cout << "No" << endl;
}


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

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

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N, L;
    cin >> N >> L;
    vector<int>apple(N);
    for (int i = 0; i < N; ++i) {
        apple[i] = L + i;
    }
    int a = 100000;
    for (int i = 0; i < N; ++i) {
        if(abs(a) > abs(apple[i])) a = apple[i];
    }
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        ans += apple[i];
    }
    ans -= a;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#define ll long double
using namespace std;
int main()
{
	
	int L;
	ll dimen;
	cin>>L;
	dimen = (long double)L/3.0;
	cout<<fixed<<setprecision(12);
	cout<<(long double)pow(dimen, 3);

	return 0;
}

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

namespace CSharpSample01
{

    

    class Program
    {
        
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int K = int.Parse(str[2]);

            int cnt = 0;
            int max = Math.Min(A, B);
            int ans = 0;

            for(int i = max; i >= 1; i--)
            {
                if(A % i == 0 && B % i == 0)
                {
                    cnt++;
                    if(cnt == K)
                    {
                        ans = i;
                    }
                }
            }


            Console.WriteLine(ans);
            
            
        }
    }
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i,n)cin >> v[i];
  long double l = 0,r = 1e10;
  int T = 100;
  while(T--){
    long double mid = (l+r)/2;
    int cnt = 0;
    rep(i,n){
      long double d = v[i]/mid;
      cnt += ceill(d)-1;
    }
    if(cnt <= k)r = mid;
    else l = mid;
  }
  cout << (int)ceil(r) << endl;


  return 0;
}

Measured memory_bytes: 3836
import scala.io.StdIn.{readLine,readInt}
import scala.collection.mutable.ArrayBuffer

object Main {
  class Node(id:Int,dist:Int) { }

  def main(args:Array[String]) = {
    val n = readInt
    val g = for(i<-0 until n) yield { readLine.trim.split(" ").map(_.toInt) }
    val dist = new Array[Int](n)
    val visited = new ArrayBuffer[Int]
    for(i<-0 until n) dist(i) = Int.MaxValue
    dist(0) = 0

    while(visited.length < n) {
      val minV = (for(i<-0 until dist.length if !visited.contains(i)) yield (dist(i),i)).min
      val min = minV._1
      val v = g(minV._2)

      for(i<-0 until v(1) if !visited.contains(v(i*2+2))) {
        if(dist(v(i*2+2)) == Int.MaxValue) dist(v(i*2+2)) = v(i*2+3) + dist(v(0))
        else if(v(i*2+3)+dist(v(0)) < dist(v(i*2+2))) dist(v(i*2+2)) = v(i*2+3)+dist(v(0))
      }
      visited += v(0)
    }
    for(i<-0 until n) {
      println(i + " " + dist(i))
    }
  }
}

Measured memory_bytes: 47776
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine

main = do
  [a,b] <- getIntList
  putStrLn $ if a < b then check' a b else check' b a

check' a b = concat $ replicate b $ show a

Measured memory_bytes: 380
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
#define ll long long
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int h, w, n;
P a[114514];
bool u;
int cnt;
int ans[10];

signed main() {
	cin >> h >> w >> n;
	rep(i, n) {
		cin >> a[i].first >> a[i].second;
		a[i].first--;
		a[i].second--;
	}
	sort(a, a + n);
	rep(i, n) {
		for (int j = a[i].first - 2; j <= a[i].first; j++) {
			for (int k = a[i].second - 2; k <= a[i].second; k++) {
				u = true;
				cnt = 0;
				rep(l, 3) {
					rep(m, 3) {
						if (j + l < 0 || j + l >= h || k + m < 0 || k + m >= w)u = false;
						else if (binary_search(a, a + n, P(j + l, k + m))) {
							cnt++;
						}
					}
				}
				if (u) {
					ans[cnt]++;
				}
			}
		}
	}
	int mu = (w - 2) * (h - 2);
	for (int i = 1; i <= 9; i++){
		ans[i] /= i;
		mu -= ans[i];
	}
	cout << mu << endl;
	rep(i, 9)cout << ans[i + 1] << endl;
}

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

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

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

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int x,count=0,MSprime[40000];
	bool isMSprime[300000]={};
	for(int i=6;;i+=5){
		if(isMSprime[i]==false){
			for(int k=2;i*k<300000;k++){
				isMSprime[i*k]=true;
			}
			MSprime[count++]=i;
		}
		i+=2;
		if(i>=300000)break;
		if(isMSprime[i]==false){
			for(int k=2;i*k<300000;k++){
				isMSprime[i*k]=true;
			}
			MSprime[count++]=i;
		}
	}
	MSprime[count]=300000;

	while(1){
		cin>>x;
		if(x==1)break;
		cout<<x<<':';
		for(int i=0;MSprime[i]<=x;i++){
			if(x%MSprime[i]==0){
				cout<<' '<<MSprime[i];
			}
		}
		cout<<endl;;

	}

	return 0;
}

Measured memory_bytes: 1608
import java.util.Scanner;

class Main {
  static Scanner in = new Scanner(System.in);
  public static void main(String[] args) {
    
    while(in.hasNext()){
      int sum = 0;
      String input = in.next();
      if (input.equals("0")) break;
      for (int i = 0; i < input.length(); i++) sum += input.charAt(i) - '0';
      System.out.println(sum);
    }
  }
}

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

int N,M,Q;
vector<int> a(50),b(50),c(50),d(50);
int total = 0;

void dfs(vector<int> &v){
  if((int)v.size() == N){
    int tmp_total = 0;
    rep(i,Q){
      if(v.at(b.at(i)) - v.at(a.at(i)) == c.at(i)) tmp_total += d.at(i);
    }
    total = max(total,tmp_total);
    return;
  }
  int st = 1;
  if((int)v.size()) st = v.back();
  for(int i=st; i<=M; i++){
    v.push_back(i);
    dfs(v);
    v.pop_back();
  }
}

int main(){
  cin >> N >> M >> Q;
  
  rep(i,Q){
    cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
    a.at(i)--;
    b.at(i)--;
  }
  vector<int> v;
  dfs(v);
  cout << total << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

typedef long long ll;
typedef pair<int, int> Pii;


int main(){

    int N;
    string s;
    getline(cin, s);
    N = atoi(s.c_str());

    vector<int> A(N);

    int i = 0;
    while(getline(cin, s, ' ')){
        A[i] = atoi(s.c_str());
        i++;
    }

    sort(A.begin(), A.end());

    cout << A[N - 1] - A[0];

    return 0;
    
}

Measured memory_bytes: 256
#! usr/bin/env python
# -*- coding: utf-8 -*-

from collections import deque
import heapq
import math
import bisect


def main():
    N = int(input())
    A = list(map(int, input().split()))
    dp = [[-1]*2 for i in range(N+1)]

    dp[0][0] = A[0]
    dp[0][1] = -A[0]
    for i in range(N-2):
        dp[i+1][0] = max(dp[i][0]+A[i+1], dp[i][1]-A[i+1])
        dp[i+1][1] = max(dp[i][0]-A[i+1], dp[i][1]+A[i+1])

    print(max(dp[N-2][0]+A[N-1], dp[N-2][1]-A[N-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 72608
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll 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 main(void)
{
    int a,b;
    cin >> a >> b;
    string ab = string(b, '0' + a);
    string ba = string(a,'0'+b);

    if(ab <= ba){
        cout << ab << endl;
    }
    else{
        cout << ba << endl;
    }

    return 0;
}

Measured memory_bytes: 256
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
use std::cmp::max;
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
struct Cell {
    len: usize,
    prev: usize,
}
impl Cell {
    fn new(len: usize, prev: usize) -> Cell {
        Cell {
            len: len,
            prev: prev,
        }
    }
}
fn main() {
    input! { s: chars, t: chars };
    let ns = s.len();
    let nt = t.len();
    let mut dp = vec![vec![Cell::new(0, 0); nt + 1]; ns + 1];
    for i in 0..ns {
        for j in 0..nt {
            dp[i + 1][j + 1] = max(
                Cell::new(dp[i + 1][j].len, 1),
                Cell::new(dp[i][j + 1].len, 2),
            );
            if s[i] == t[j] {
                dp[i + 1][j + 1] = max(dp[i + 1][j + 1], Cell::new(dp[i][j].len + 1, 0));
            }
        }
    }
    let mut i = ns;
    let mut j = nt;
    let mut ans = vec![];
    while i != 0 && j != 0 {
        let cell = dp[i][j];
        match cell.prev {
            0 => {
                ans.push(s[i - 1]);
                i -= 1;
                j -= 1;
            }
            1 => {
                j -= 1;
            }
            2 => {
                i -= 1;
            }
            _ => (),
        }
    }
    println!("{}", ans.into_iter().rev().collect::<String>());
}


Measured memory_bytes: 166268
import math
a, b, x = map(float, input().split())
if x == b*a**2:
    print(0)
elif x <= b*a**2*0.5:
    print(math.degrees(math.atan(a*b**2/x*0.5)))
else:
    print(math.degrees(math.atan(2*(b*a**2-x)/a**3)))

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)

ll GCD(ll a, ll b)
{
	if (a%b == 0)
	{
		return(b);
	}
	else
	{
		return(GCD(b, a%b));
	}
}

ll LCM(ll a, ll b)
{
	return a * b / GCD(a, b);
}

int main() {
	ll n, x;
	cin >> n >> x;
	vector<ll>dist(n);
	FOR(i, 0, n-1) {
		ll sx;
		cin >> sx;
		dist[i] = abs(sx - x);
	}
	ll res = dist[0];
	FOR(i, 1, n - 1) {
		res = GCD(res, dist[i]);
	}
	pv(res)
	return 0;
}

Measured memory_bytes: 3956
#include <iostream>
using namespace std;
#define INFTY 1000005
long long n,m,P[INFTY],A[INFTY],B[INFTY],C[INFTY],cnt[INFTY];
int main(){
    //cout<<endl;
    cin>>n>>m;
    for(int i=0; i<=n; i++) {cnt[i]=0;}
    for(int i=1; i<=m; i++) cin>>P[i];           
    for(int i=1; i<m; i++) {
        if(P[i+1]-P[i]>=0){ cnt[P[i]]++; cnt[P[i+1]]--;}
        else { cnt[P[i]]--; cnt[P[i+1]]++;}
    }
    for(int i=1; i<n; i++){
        cnt[i]+=cnt[i-1];
    }
    
    for(int i=1; i<n; i++) cin>>A[i]>>B[i]>>C[i];
    long long ans=0;
    for(int i=1; i<n; i++){
        if(A[i]*cnt[i]>B[i]*cnt[i]+C[i]) ans+=B[i]*cnt[i]+C[i];
        else ans+=A[i]*cnt[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7012
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	int N, M, K;
	while (cin >> N >> M >> K&&N) {
		int ans = 0;
		for (int i = 1; i < K; i++) {
			for (int j = 1; j < K; j++) {
				if (i*(100 + N) / 100 + j*(100 + N) / 100 > K)break;
				if (i*(100 + N) / 100 + j*(100 + N) / 100 == K) {
					ans = max(ans, i*(100 + M) / 100 + j*(100 + M) / 100);
				}
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3072
class Dice:	
	def __init__( self, nums ):
		self.face = nums
	
	def rolltoTopIndex( self, faceindex ):	
		if faceindex == 1:
			self.roll( "N" )
		elif faceindex == 2:
			self.roll( "W" )
		elif faceindex == 3:
			self.roll( "E" )
		elif faceindex == 4:
			self.roll( "S" )
		elif faceindex == 5:
			self.roll( "NN" )
	
	def roll( self, actions ):
		for act in actions:
			t = 0
			if act == "E":
				t =   self.face[0]
				self.face[0] =   self.face[3]
				self.face[3] =   self.face[5]
				self.face[5] =   self.face[2]
				self.face[2] = t
			elif  act == "N":
				t =   self.face[0]
				self.face[0] =   self.face[1]
				self.face[1] =   self.face[5]
				self.face[5] =   self.face[4]
				self.face[4] = t
			elif  act == "S":
				t =  self.face[ 0]
				self.face[0] =  self.face[4]
				self.face[4] =  self.face[5]
				self.face[5] =  self.face[1]
				self.face[1] = t	
			elif  act == "W":
				t =  self.face[0]
				self.face[0] =  self.face[2]
				self.face[2] =  self.face[5]
				self.face[5] =  self.face[3]
				self.face[3] = t	
			elif  act == "M":
				t =  self.face[1]
				self.face[1] =  self.face[2]
				self.face[2] =  self.face[4]
				self.face[4] =  self.face[3]
				self.face[3] = t

diceface = [ int( val ) for val in input( ).split( " " ) ]
dice1 = Dice( diceface )
diceface = [ int( val ) for val in input( ).split( " " ) ]
dice2 = Dice( diceface )


cnt = 0
for i in range( 6 ):
	if dice1.face[0] == dice2.face[i]:
		dice2.rolltoTopIndex( i )
		for j in range( 1, 5 ):
			if dice1.face[1] == dice2.face[1]:
				cnt = 0
				for k in range( 6 ):
					if dice1.face[k] == dice2.face[k]:
						cnt += 1
				if cnt == 6:
					break
			dice2.roll( "M" )
	if cnt == 6:
		break
	dice2.face = diceface


if cnt == 6:
	print( "Yes" )
else:
	print( "No" )

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

#define ll long long
using namespace std;

#define MAXN 200000

void solve()
{
	int N;
	ll A[MAXN];
	cin>>N;
	for(int i=0; i<N; ++i)
		cin>>A[i];
	ll sum = 0;
	for(int i=0; i<N; ++i)
		sum+=A[i];
	ll a = -1;
	ll s = 0;
	for(int i=0; i<N; ++i)
	{
		s+=A[i];
		if(s>sum/2)
		{
			a=i;
			break;
		}
	}
	ll ans = min(2*s - sum, sum - 2*(s-A[a]));
	cout<<ans<<endl;
	

}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//int T;
	//cin>>T;
	//while(T--)
		solve();
		
	return 0;
}


Measured memory_bytes: 1792
N, M = map(int, (input().split()))

ab = [[0 for i in range(2)] for j in range(M)]

for i in range(M):
    ab[i] = list(map(int, input().split()))


ab2 = sorted(ab, key=lambda x:(x[0], x[1]), reverse=False)
# print(ab2)

count = 0

def func(ablist):
    mi = 0
    ma = float('inf')
    for i in range(len(ablist)):
        mi = max(mi, ablist[i][0])
        ma = min(ma, ablist[i][1] - 1)
#        print(mi, ma)
        if mi > ma:
            return func(ablist[i:]) + 1
    return 1

print(func(ab2))


Measured memory_bytes: 132360
#include<iostream>
#include<cmath>
#include<string>
#include<list>
#include<vector>
#include<algorithm>
#include <numeric>
#include<queue>
#include <climits>

using namespace std;

int main(int argc, char const *argv[])
{
	/*
	cin>>x;
	cout<<x<<endl;
	*/
	int a,b,c,i,j,n,ans;
	cin>>a>>b>>c;

	for(i=0;i<10;i++){
		c=a*c-b;
		cout<<c<<endl;
	}

}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine().toLowerCase();
		String line = "";
		while(true) {
			String tmp = sc.nextLine();
			if(tmp.equals("END_OF_TEXT")) {
				break;
			}
			line += " " + tmp;
		}

		int count = 0;

		if(line.toLowerCase().contains(x)) {
			String[] tmp = line.toLowerCase().split(" ");
			for(int i=0;i<tmp.length;i++) {
				if(tmp[i].equals(x)) {
					count++;
				}
			}
		}

		System.out.println(count);

		sc.close();
	}
}


Measured memory_bytes: 26260
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

s = list(str(input()))
t = list(str(input()))

s.sort()
t.sort(reverse=True)

s = "".join(s)
t = "".join(t)

ans = sorted([s, t])
# print(ans)

if ans[0] == t:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9072
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val datN = readLine.split("").filterNot(_ == "").map(_.toInt)

    val ans = datN.sum % 9 == 0
    println(if(ans) "Yes" else "No")
  }
}


Measured memory_bytes: 68276
/*
    Mbak Rose Dong
*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
long long int arr[100100], dp[100100];
int n;
long long int power(long long int a, long long int b)
{
    long long int ret = 1;
    if(b == 0)
        return ret;
    else
    {
        while(b>0)
        {
            if(b % 2 == 1)
            {
                ret = (ret*a) % mod;
            }
            b /= 2;
            a = (a*a) % mod;
        }
        return ret % mod;
    }
}
int main()
{
	int i,j,k,x,y,ans,m,curr;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
    {
        arr[i] = 1;
    }
    for(i=1;i<=m;i++)
    {
        scanf("%d",&curr);
        arr[curr] = 0;
    }
    if(n == 1)
    {
        cout << "1" << endl;
        return 0;
    }
    for(i=1;i<n;i++)
    {
        if(arr[i] + arr[i+1] == 0)
        {
            printf("0\n");
            return 0;
        }
    }
    dp[0] = 1;
    if(arr[1] == 1)
    {
        dp[1] = 1;
    }
    for(i=2;i<=n;i++)
    {
        if(arr[i] == 0)
        {
            dp[i] = 0;
            continue;
        }
        for(j=1;j<=2;j++)
        {
            dp[i] += dp[i-j] % mod;
        }
    }
    long long int rose;
    rose = dp[n] % mod;
    cout << rose << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	int K,T;
	vector<int> a_array;
	cin>>K>>T;
	
	REP(i,T){
		int data;
		cin>>data;
		a_array.push_back(data);
	}
		sort(a_array.begin(),a_array.end());
	long answer = 0;	

	if(T == 1){
		cout<<a_array[0]-1<<endl;
		return 0;
	}

	while(1){
		if(a_array[T-1] == 0){
			break;
		}
		a_array[T-1]--;
		if(a_array[T-2] == 0){
			answer = a_array[T-1];
			break;
		}
		a_array[T-2]--;
		sort(a_array.begin(),a_array.end());
	}
	
	cout<<answer<<endl;

	return 0;
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    int LMax = 1;
    int RMin = N;
    for(int i = 0; i < M; i++)
    {
        int L;
        int R;
        cin >> L >> R;
        LMax = max(LMax, L);
        RMin = min(RMin, R);
    }
    if(RMin + 1 >= LMax)
        cout << RMin - LMax + 1 << endl;
    else
        cout << "0" << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
box = [i for i in range(N,100004)]
box = [i for i in box if not i % 2==0]
box = [i for i in box if not i % 3==0]
box = [i for i in box if not i % 5==0]
box = [i for i in box if not i % 7==0]
primes = [2]
for i in range(3, N, 2):
    all(i % p != 0 for p in primes) and primes.append(i)
for i in box:
    if N ==2:
        print(2)
        break
    elif all(i % p != 0 for p in primes):
        print(i)
        break

Measured memory_bytes: 44796
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

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

ll deg(int i){
  ll ret = 1;
  while(i != 0){
    if(i/10 == 0){
      break;
    }
    i/=10;
  }
  
  return i;
}

void solve(){
  string s;
  cin >> s;
  if(s[2]==s[3]&&s[4]==s[5]) cout << "Yes"<<endl;
  else cout <<"No" << endl;


}


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


Measured memory_bytes: 256
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let mut it = line
        .trim()
        .split_terminator('/')
        .map(|x| x.parse::<usize>().unwrap());
    let y = it.next().unwrap();
    let m = it.next().unwrap();
    let d = it.next().unwrap();
    if m <= 4 {
        println!("Heisei");
    } else {
        println!("TBD");
    }
}


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

using namespace std;

typedef long long  ll;

int Partition(vector<tuple<char, int, int>> &a, int p, int r)
{
    int x = get<1>(a[r]), i = p - 1;

    for (int j = p; j < r; ++j)
        if (get<1>(a[j]) <= x)
            swap(a[++i], a[j]);

    swap(a[i + 1], a[r]);

    return i + 1;
}

void QuickSort(vector<tuple<char, int, int>> &a, int p, int r)
{
    if (p < r) {
        int q = Partition(a, p, r);
        QuickSort(a, p, q - 1);
        QuickSort(a, q + 1, r);
    }
}

bool Check(vector<tuple<char, int, int>> &a)
{
    const int n = a.size();
    int left = 0, right = 1;

    while (left < n) {
        right = left + 1;
        while (right < n && get<1>(a[left]) == get<1>(a[right])) {
            if (get<2>(a[right]) < get<2>(a[left]))
                return false;
            ++right;
        }
        left = right;
    }

    return true;
}

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

    int n;

    cin >> n;
    vector<tuple<char, int, int>> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> get<0>(a[i]) >> get<1>(a[i]);
        get<2>(a[i]) = i;
    }

    QuickSort(a, 0, n - 1);

    if (Check(a))
        cout << "Stable\n";
    else
        cout << "Not stable\n";

    for (int i = 0; i < n; ++i)
        cout << get<0>(a[i]) << " " << get<1>(a[i]) << "\n";

    return 0;
}

Measured memory_bytes: 2316
#include <stdio.h>
#include <limits.h>
 
#define MAX 200000
#define INF INT_MAX
typedef long long ll;
 
void merge(int*, int, int, int);
void mergesort(int*, int, int);
 
ll ans;
 
int n, a[MAX];
 
int main(){
  int i;
 
  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d" ,a + i);
  }
  mergesort(a,0,n);
  printf("%lld\n" ,ans);
 
  return 0;
}
 
void merge(int a[], int left, int mid, int right){
  int n1 = mid - left, n2 = right - mid;
  int L[n1+1], R[n2+1], i, j, k;
  
  for(i = 0 ; i < n1 ; i++){
    L[i] = a[left + i];
  }
  
  for(i = 0 ; i < n2 ; i++){
    R[i] = a[mid + i];
  }
  
  L[n1] = R[n2] = INF;
  
  for(i = 0, j = 0, k = left ; k < right ; k++){
    if(i < n1 && (j == n2 || L[i] <= R[j])){
      a[k] = L[i++];
    }else{
      ans += (n1 + n2) / 2 - i;
      a[k] = R[j++];
    }
  }
}

void mergesort(int a[], int left, int right){
  int mid;
  
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergesort(a, left, mid);
    mergesort(a, mid, right);
    merge(a, left, mid, right);
  }
}


Measured memory_bytes: 4284
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;

int main() {
    i64 k;
    cin >> k;
    i64 ans = 0;
    for (i64 a = 1; a <= k; ++a) {
        for (i64 b = 1; b <= k; ++b) {
            for (i64 c = 1; c <= k; ++c) {
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 998244353
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(all(a));
  LL ans=a[0];
  repp(i,1,n){
    ans=ans*gcd(i,a[i])%MOD;
  }
  cout << ans << endl;
  return 0;
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep1(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep1は「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//reprは「ｓからnまで」の繰り返し

typedef long long ll;

const ll inf = 1e18+7;
const ll mod = 1e9+7;


int main() {
    int n;
    cin>>n;
    cout<<(n+1)/2<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    if(s[0] == s[1] and s[2] == s[1]) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void){
    double x1,y1,x2,y2;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    printf("%f\n",sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
    return 0;
}

Measured memory_bytes: 652
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[100][10001],n,a[100],cnt=0,res,p=1000;
signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++) cin>>a[i];
	a[n+1]=-1;
	for (int i=1;i<=n;i++)
	{
		cnt+=p/a[i];
		p=p%a[i];
		if (a[i]>a[i+1]) p+=cnt*a[i],cnt=0;
	}
	cout<<p<<endl;
	return 0;
}


Measured memory_bytes: 3568
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <stack>
#include <iomanip>
#include <set>
#include <queue>
#include <unordered_map>

using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int maxn = 1e5 + 7;
const int inf = 2e9 + 7;
const ll infl = 1e18 + 7;
const long double eps = 1e-9;
const ll mod = 1e9 + 7;

ll dp[(int)1e4 + 7][107][10];

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif // _DEBUG

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	string s;
	int d;
	cin >> s >> d;
	/*if (d == 1) {
		ll ans = 0;
		for (int i = 0; i < s.size(); i++) {
			ans = ((ans * 10) % mod + s[i] - '0') % mod;
		}
		cout << ans;
		return 0;
	}*/
	for (int i = 0; i < 10; i++) {
		dp[0][i % d][i]++;
	}
	int n = s.size();
	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < d; j++) {
			for (int k = 0; k < 10; k++) {
				for (int q = 0; q < 10; q++) {
					dp[i + 1][(j + q) % d][q] = (dp[i + 1][(j + q) % d][q] + dp[i][j][k]) % mod;
				}
			}
		}
	}
	reverse(s.begin(), s.end());
	ll ans = 0, sum = 0;
	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j <= s[i] - '0' - 1; j++) {
			ans = (ans + dp[i][(d - sum + d) % d][j]) % mod;
		}
		sum += s[i] - '0';
		sum %= d;
	}
	if (sum == 0) {
		ans = (ans + 1) % mod;
	}
	cout << (ans - 1 + mod) % mod;
	return 0;
}


Measured memory_bytes: 83840
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
using namespace std;

double dis(pair<double, double> p1, pair<double, double> p2)
{
    double ans = (p1.first - p2.first) * (p1.first - p2.first) + (p1.second - p2.second) * (p1.second - p2.second);
    return sqrt(ans);
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed;
    cout.precision(10);
    int n;
    cin >> n;
    pair<double, double> p[n];
    double base = 1;
    for(int i = 0; i < n; i++)
    {
        cin >> p[i].first >> p[i].second;
        base *= (i + 1);
    }
    double ans = 0;
    base /= n;
    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n; j++)
        {
            ans += dis(p[i], p[j]) * base * 2;
        }
    }
    base *= n;
    ans /= base;
    cout << ans;

	return 0;
}


Measured memory_bytes: 256