akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#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 wFor(i,a,b) for(ll i=a;i<b;i+=2)
#define wrFor(i,a,b) for(ll i=a;i>b;i-=2)
#define sort(a,b) sort(a.begin(),b.end())
#define reverse(a,b) reverse(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
//(char-'0') 数字に変換
//vector<vector<int>> data(a,vector<int>(b)) a×b行列
//for(int i=0;i<a;i++)
//for(int j=0;j<b;j++)
//cin>>data.at(i).at(j)  a×b行列の入力
//floor(log10(a)+1) aの10進法での桁数
//ceil(log10(a)) aの10進法での桁数

int main() {
  ll a;
  string b;
  ci(a>>b);
  ll an=a;
  For(i,1,a)
    if(b[i-1]==b[i])
      an--;
  co(an);
}

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

main() {
    int a,b,c,d; cin >> a >> b >> c >> d;
    if(abs(a-c)<=d || a<=b && c>=b && b-a<=d && c-b<=d ||
    a>=b && c<=b && b-c<=d && a-b<=d)
    cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
struct result{
	char name;
	int win;
	int draw;
	int id;
};
int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		pair<int, int>amax(-1, -1);
		vector<result>res;
		for (int i = 0; i < N; ++i) {
			char c; cin >> c;
			pair<int, int>score;
			for (int j = 0; j < N - 1; ++j) {
				int a; cin >> a;
				if (a == 0)score.first++;
				else if (a == 2)score.second++;
			}
			res.push_back(result{ c,score.first,score.second,i });

		}
		sort(res.begin(), res.end(), [](const result&l, const result&r) {
			return l.win == r.win ? l.draw == r.draw ? l.id<r.id : l.draw>r.draw : l.win>r.win;
		});
		for (auto r : res) {
			cout << r.name << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();


int main() {
    ll n, m;
    cin >> n >> m;
    if (n < m) swap(n, m);
    if (m == 1) {
        if (n == 1)
            cout << 1 << endl;
        else
            cout << n-2 << endl;
    } else {
        cout << (n-2)*(m-2) << endl;
    }
    return 0;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;
long long ans,cnt;
int i;
string s;
int main()
{
    cin>>s;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='W')
        {
            ans+=cnt;
        }
        else cnt++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int main() {
  string s;
  cin >> s;

  bool ok = true;
  for (int i = 0; i < 4; ++i) {
    if (i < s.size() && s[i] == "YAKI"[i]) {
      ok = true;
    } else {
      ok = false;
      break;
    }
  }
  puts(ok ? "Yes": "No");

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,x;
	cin>>x>>a>>b;
	if(abs(x-a)<=abs(x-b)){
		cout<<'A'<<endl;
		
	}
	
	else cout<<'B'<<endl;
}

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

using namespace std;

class Solution {
public:
	void solve() {
		long long x;
		cin >> x;
		long long y = 100;
		for (int i = 1;; i++) {
			y += y / 100;
			if (y >= x) {
				cout << i << endl;
				return;
			}
		}
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

int main(int argc, char const *argv[])
{
	int n, m; cin >> n >> m;
	cout << (1900 * m + 100 * (n - m)) * pow(2, m) << endl;
	return 0;
}

Measured memory_bytes: 512
X = int(input())
uresisa = 0
while True:
    if X >= 500000:
        X -= 500000
        uresisa += 1000000
    else:
        break

while True:
    if X >= 500:
        X -= 500
        uresisa += 1000
    else:
        break
while True:
    if X >= 5:
        X -= 5
        uresisa += 5
    else:
        break

print(uresisa)

Measured memory_bytes: 3060
from itertools import permutations
import math

n = int(input())

def readlines():
    for _ in range(n):
        x, y = map(int, input().split())
        yield x, y

def distance(u, v):
    return math.sqrt((v[0] - u[0]) ** 2 + (v[1] - u[1]) ** 2)

def lengths():
    for path in permutations(readlines()):
        length = 0
        for i in range(n-1):
            length += distance(path[i], path[i+1])
        yield length

print(sum(lengths()) / math.factorial(n))

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var n = Integer.parseInt(br.readLine());

      switch (n % 10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
          System.out.println("hon");
          break;
        case 0:
        case 1:
        case 6:
        case 8:
          System.out.println("pon");
          break;
        case 3:
          System.out.println("bon");
          break;
      }
    }
  }
}


Measured memory_bytes: 32528
use std::io::Read;
use std::ops::AddAssign;

const MAX: i64 = 100_001;
const MOD: i64 = 1_000_000_007;

struct BinaryIndexedTree<T> {
    n: usize,
    data: Vec<T>,
}

impl<T: Default + Copy + AddAssign> BinaryIndexedTree<T> {
    fn new(n: usize) -> BinaryIndexedTree<T> {
        BinaryIndexedTree {
            n: n,
            data: vec![Default::default(); n],
        }
    }

    fn add(&mut self, i: usize, x: T) {
        let mut i = i;
        while i < self.n {
            self.data[i] += x;
            i |= i + 1;
        }
    }

    // iは1-indexed
    fn sum(&self, i: usize) -> T {
        let mut i = i;
        let mut sum = Default::default();

        loop {
            sum += self.data[i];
            i = i & (i + 1);
            if i > 0 {
                i -= 1;
            } else {
                break;
            }
        }
        return sum;
    }

    fn clear(&mut self) {
        for i in 0..self.data.len() {
            self.data[i] = Default::default();
        }
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let n = iter.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (0..n)
        .map(|_| iter.next().unwrap().parse().unwrap())
        .collect();

    let target_count = (n as i64 * (n + 1) as i64 / 2 + 1) / 2;
    let offset = n + 2;
    let mut bit = BinaryIndexedTree::new(offset * 2);
    let mut lb = 0;
    let mut ub = a.iter().max().unwrap() + 1;

    while ub - lb > 1 {
        let mb = (ub + lb) / 2;
        let mut count = 0;
        let mut sum = 0;
        bit.clear();
        bit.add(offset, 1);

        for i in 0..n {
            if a[i] >= mb {
                sum += 1;
            } else {
                sum -= 1;
            }
            let pos = (sum + offset as i32) as usize;
            count += bit.sum(pos);
            bit.add(pos, 1);
        }
        //        dbg!(mb, count, target_count);
        if count >= target_count {
            lb = mb;
        } else {
            ub = mb;
        }
    }
    println!("{}", lb);
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll f[30];
ll n;
char x[30];
ll ans=0;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for (ll i=1;i<=n;i++){
		cin>>x; f[x[0]-'A']++;
	}
	ll m=f[12],a=f[0];
	ll r=f[17],c=f[2];
	ll h=f[7];
	//cout<<m<<a<<r<<c<<h<<endl;
	ans=r*c*h+a*c*h+a*r*h+a*r*c+m*c*h+m*r*h+m*r*c+m*a*h+m*a*c+m*a*r;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() 
{
	ll n;
  cin>>n;
  while(n!=0)
  {
    if(n%10==7)
    {
      cout<<"Yes";
      return 0;
    }
    n/=10;
  }
  cout<<"No";
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;


/**
 *
 * @author
 *
 *
 *
 */

public class Main {


    public static void main(String[] args) throws IOException {
        MyScanner scanner = new MyScanner();
        PrintStream out = System.out;

        Main main = new Main();

        int n = scanner.nextInt();

        long s = (1 + n) * n /2;

        out.println(s);

        scanner.reader.close();
        out.close();
    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader reader;

        public MyScanner() {
            this.reader = new BufferedReader(new InputStreamReader(System.in));
        }

        public void close() throws IOException {
            this.reader.close();
        }

        int nextInt() {
            return Integer.parseInt(this.next());
        }

        long nextLong() {
            return Long.parseLong(this.next());
        }

        double nextDouble() {
            return Double.parseDouble(this.next());
        }

        String next() {
            String str = "";
            try {
                str = this.reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        String[] nextStringArray() {
            String[] str = null;
            try {
                str = this.reader.readLine().trim().split(" ");
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray() {
            String[] data  = nextStringArray();
            int[] a  = new int[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Integer.parseInt(data[i]);
            }

            return a;
        }

        Integer[] nextIntegerArray() {
            String[] data  = nextStringArray();
            Integer[] a  = new Integer[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Integer.parseInt(data[i]);
            }

            return a;
        }

        long[] nextLongArray() {
            String[] data  = nextStringArray();
            long[] a  = new long[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Long.parseLong(data[i]);
            }

            return a;
        }
    }
}



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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    ll x;
//    x=1ll << 59;
//    ll y=(1ll << 59) - 1ll;
//    cout<<((double)(x)==(double)(x-1))<<endl;
    ll n;
    cin>>n;
    char l1[n+1];
    set<char>s;
    for(int i=1;i<=n;i++){
        cin>>l1[i];
        s.insert(l1[i]);
    }
    if(s.size()==3)cout<<"Three";
    else cout<<"Four";
}


Measured memory_bytes: 3632
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());

    vector<P> CB(M);
    for (int i = 0; i < M; i++) {
        int b, c;
        cin >> b >> c;
        CB[i] = P(c, b);
    }
    sort(CB.begin(), CB.end(), greater<>());

    int i = 0;
    int j = 0;
    while (i < N && j < M) {
        if (CB[j].second <= 0) j++;
        if (j >= M) break;

        A[i] = max(A[i], CB[j].first);
        CB[j].second--;
        i++;
    }

    int sum = 0;
    for (int i = 0; i < N; i++) sum += A[i];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <cstdio>
#include <cctype>
#include <string>

using std::string;

inline void setIO(string file){
	string in=file+".in",out=file+".out";
	freopen(in.c_str(),"r",stdin);
	freopen(out.c_str(),"w",stdout);
}

template<typename type>
inline void read(type &x){
	int pm=1; char c;
	do{
		c=getchar();
		if(c=='-') pm=-1;
	}while(!isdigit(c));
	x=c^'0';
	while(c=getchar(),isdigit(c))
		x=x*10+(c^'0');
	x*=pm;
}

template<typename type>
void write(type x,char c=0){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10|'0');
	if(c) putchar(c);
}

#include <algorithm>

using std::min;

int n,m;

inline long long cal1(){
	long long ret=0;
	for(int l=m+1,r;l<=n;l=r+1){
		r=min(n,(n+1)/((n+1)/l));
		ret+=(long long)(n+1)/l*(((long long)(l+r)*(r-l+1)>>1)-(long long)(r-l+1)*m);
	}
	return ret;
}

inline int bin_chop_l(int l,int r){
	int mid,div=n/l;
	while(l<=r){
		mid=l+r>>1;
		if(mid*(div+1)>n+1)
			r=mid-1;
		else l=mid+1;
	}
	return l;
}

inline int bin_chop_r(int l,int r){
	int mid,div=n/l;
	while(l<=r){
		mid=l+r>>1;
		if(mid*div<=n-m)
			l=mid+1;
		else r=mid-1;
	}
	return r;
}

inline long long cal2(){
	long long ret=0;
	for(int l=m+1,r,lp,rp;l<=n;l=r+1){
		r=n/(n/l);
		lp=bin_chop_l(l,r);
		rp=bin_chop_r(l,r);
		ret+=(long long)(rp-lp+1)*(n-m+1)-(long long)n/l*((long long)(lp+rp)*(rp-lp+1)>>1);
	}
	return ret;
}

int main(){
	//setIO("mod");
		read(n),read(m);
		if(m==0) write((long long)n*n,'\n');
		else write(cal1()+cal2(),'\n');
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<map>
using namespace std;
int main(){  
    int n,d,x;
    cin>>n>>d>>x;
    for (int i = 0; i < 10; i++)
    {
        x=x*n-d;
        cout<<x<<endl;
    }
    

    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
 
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e13;
const ll mod = 1e9 + 7;
const ll N = 2e4 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	read(n);
	if (n == 2) {cout << 1; return 0;}
	int sqr = sqrt(n);
	set <int> s;
	
	FOR (i, 2, sqr)
	{
	    if ((n - 1) % i == 0)
    	    s.insert(i), s.insert(n/i);
	}
	s.insert(n - 1);
	s.insert(n);
	
	FOR (i, 2, sqr)
	{
	    if (n % i == 0)
	    {
	        int t = i, icpy = i, x = inf/icpy;
	        while (true)
	        {
	            if (t > x || (n % (t*i))) break;
	            t *= i;
	        }
	        
	        int cpy = n/t;
	        if (cpy % icpy == 1) s.insert(i);
	        
	        t = n/i, icpy = n/i, x = inf/icpy;
	        while (true)
	        {
	            if (t > x || (n % (t*icpy))) break;
	            t *= icpy;
	        }
	        
	        cpy = n/t;
	        if (cpy % icpy == 1) s.insert(icpy);
	    }
	}
	
	cout << sz(s);
}
















Measured memory_bytes: 256
// ?§???????????????°???????????°
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int i;

		for(i=1; i<=n; i++){
			if(i > n) break;
			String x = String.valueOf(i);
			if (((i%3) == 0) || x.contains("3")) {
				System.out.print(" " + i);
			}
				
		}
		System.out.println();
	}

}

Measured memory_bytes: 30280
#include <bits/stdc++.h>
using namespace std;
int k, n;
int main() {
    cin >> n; 
    if(!(n & (n - 1))) {printf("No\n"); return 0;} 
    printf("Yes\n");
    printf("1 2\n2 3\n3 %d\n%d %d\n%d %d\n", n + 1, n + 1, n + 2, n + 2, n + 3);
    for(int i = 4; i < n; i += 2){
        printf("%d %d\n", i, 1 + n); printf("%d %d\n", i + 1, 1 + n);
        printf("%d %d\n", i + n, i + 1); printf("%d %d\n", i + n + 1, i);
    }
    if(n % 2 == 0){
        for(int i = 2; i < n; i++){
            int p = i ^ 1 ^ n;
            if(p < n) {
                if(i == 2) printf("%d %d\n", i + n, n);
                else printf("%d %d\n", i, n);
                printf("%d %d\n", p, n + n);
                return 0;
            }
        }
    }
}

Measured memory_bytes: 2816
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define EPS 1e-10
using namespace std;
typedef long long ll;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y - p.y < -EPS;
		else return x - p.x < EPS;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
struct Circle{
	Point c;
	double r;
	Circle(Point c = Point(),double r = 0.0): c(c),r(r) {}
};
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
	return a.x * b.x + a.y * b.y;
}
double det(Vector a,Vector b){
	return a.x * b.y - b.x * a.y;
}
int n;
double area(Polygon p){
	double res = 0.0;
	for(int i=1;i<n-1;i++){
		res += det(p[i] - p[0],p[i+1] - p[0]) / 2.0;
	}
	return res;
}
Polygon p;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		Point p0;
		scanf("%lf%lf",&p0.x,&p0.y);
		p.push_back(p0);
	}
	printf("%.1f\n",area(p));
	return 0;
}



Measured memory_bytes: 3212
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
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;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//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 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())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    long long A,B,C,D;
    cin >> A >> B >> C >> D;
    long long num_lcm=lcm(C,D);
    long long ans=B-A+1;
    long long E=B-A;
    long long num_max=B/C-(A-1)/C;
    ans-=num_max;
    num_max=B/D-(A-1)/D;
    ans-=num_max;
    num_max=B/num_lcm-(A-1)/num_lcm;
    ans+=num_max;
    cout << ans;
}


Measured memory_bytes: 256
n=int(input())

ans=[0]*(n+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            f= x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f<=n:
                ans[f]+=1

for i in range(1,n+1):
    print(ans[i])


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

using namespace std;

typedef long long ll;
const int MAX_N = 10000;

ll a[MAX_N], b[MAX_N], N;
bool ans = true;

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) cin >> b[i];

  ll cnt = 0;
  for (int i = 0; i < N; i++) {
    if (a[i] <= b[i]) {
      ll tmp = (b[i] - a[i] + 1) / 2;
      cnt += tmp;
      a[i] += 2 * tmp;
    }
  }
  for (int i = 0; i < N; i++) {
    if (b[i] < a[i]) {
      if (a[i]-b[i] <= cnt) {
        cnt -= a[i] - b[i];
        b[i] = a[i];
      } else {
        ans = false;
        break;
      }
    }
  }

  cout << (ans?"Yes":"No") << endl;
  return 0;
}


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

int d[300000];

int main(){
	int n,m=1;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>d[i];
	for(int i=1;i<=n;i++){
		if(m < i){
			cout << "no" << endl;
			return 0;
		}
		if(d[i]>=10){
			m=max(i+d[i]/10,m);
		}
	}
	//d[i]を反転させる処理
	for(int i=1;i<=n/2;i++)swap(d[i],d[n+1-i]);
	m = 1;
	for(int i=1;i<=n;i++){
		if(m < i){
			cout << "no" << endl;
			return 0;
		}
		if(d[i]>=10){
			m=max(i+d[i]/10,m);
		}
	}
	
	cout << "yes" << endl;


	return 0;

}



Measured memory_bytes: 4268
/* template.cpp [[[ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)s)
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)s)
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
ll in(){ ll x; cin >> x; return x; }
vector<ll> in(size_t n){ vector<ll> v(n); each(x, v) cin >> x; return v; }
/* ]]] */

ll f(ll a, ll b){
  if (b == 0) return 0;
  ll t = a / b;
  a -= b * t;
  return b * (t * 2 - (a == 0)) + f(b, a);
}

int main(){
  ll n, x;
  cin >> n >> x;
  cout << n + f(x, n - x) << endl;
}



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

using namespace std;

#define INF 1000000000
#define INFLL 0x3f3f3f3f3f3f3f3fLL 
#define EPS 10e-9
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define st first
#define nd second
#define sz(v) int(v.size())
#define all(X) (X).begin(), (X).end()
#define FOR(I, A, B) for(int I = A; I < B; I++)
#define RFOR(I, A, B) for(int I = A; I >= B; I--)

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<iii> viii;
typedef vector<ll> vll;

int main(){
	int k;
	cin >> k;
	string s;
	cin >> s;
	if(sz(s) <= k){
		cout << s  << endl;
		return 0;
	}
	while(sz(s) > k){
		s.pop_back();
	}
	cout << s << "..."<<endl;
	return 0;
}


Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush

sys.maxsize = 1_000_000_000_000_000_000_0

def solve():
    a, b = map(float, input().split())

    a = int(a)
    b = int(b * 100 + 0.5)

    # print(a, b)
    t = a * b
    print((t - t % 100) // 100)

if __name__ == '__main__':
    solve()



Measured memory_bytes: 9320
from collections import deque

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

for i in range(n-1):
    a, b, c = map(int, input().split())
    a -= 1; b -= 1
    to[a].append([b, c])
    to[b].append([a, c])

dist = [0 for _ in range(n)]
visited = [False for _ in range(n)]

def dfs(root):
    d = deque()
    d.append(root)
    while len(d) > 0:
        v = d.pop()
        visited[v] = True
        for u, c in to[v]:
            if visited[u]:
                continue
            d.append(u)
            dist[u] = dist[v]+c

q, k = map(int, input().split())
dfs(k-1)

for i in range(q):
    x, y = map(int, input().split())
    x -= 1; y -= 1
    print(dist[x]+dist[y])

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  int X,A,B;
  cin >> X >> A >> B;

  if(A >= B){
    cout << "delicious" << endl;
  }else if(A+X>=B){
    cout << "safe" << endl;
  }else{
    cout << "dangerous" << endl;
  }

}



Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ull = unsigned long long;

int main()
{
    int n; 
    ull k; 
    cin >> n >> k;
    ull num[100001];
    for (int i = 0; i < 100001; ++i) num[i] = 0;

    for (int i = 0; i < n; ++i) {
        int a;
        ull b;
        cin >> a >> b;
        num[a] += b;
    }

    ull tmp = 0ULL;
    int ans;
    for (int i = 1; i < 100001; ++i) {
        tmp += num[i];
        if (tmp >= k) {
            ans = i;
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import sys

while True:
	h, w = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 ==h and 0 == w:
		break
	pa = [ "#", "." ]
	ouput = []
	for i in range( h ):
		for j in range( w ):
			ouput.append( pa[(i+j)%2] )	
		ouput.append( "\n" )	
	print( "".join( ouput ) )

Measured memory_bytes: 7008
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 110000;
int N;
ll A[Max], B[Max];
pair<ll, int> ABsum[Max];

int main(int argc, const char * argv[]) {
    cin >> N;
    rep(i, N) {
        cin >> A[i] >> B[i];
    }

    rep(i, N) {
        ABsum[i] = make_pair(-(A[i] + B[i]), i);
    }

    sort(ABsum, ABsum+N);

    ll aoki = 0;
    ll taka = 0;
    rep(i, N) {
        int idx = ABsum[i].second;
        if (i % 2 ==0) {
            taka += A[idx];
        } else {
            aoki += B[idx];
        }
    }

    output(taka - aoki);

    return 0;
}

Measured memory_bytes: 3456
fun main(args:Array<String>) {
    val itemCount = readLine()!!.toInt()
    val itemList = readLine()!!.split(" ").map { it.toInt() }
    val ans = if(canSort(itemList)) "YES" else "NO"
    println(ans)
}

fun canSort(itemList:List<Int>):Boolean {
    val target = (1..itemList.size).toList()
    if (! itemList.sorted().withIndex().all { it.value == target[it.index]}) {
        return false
    }
    return itemList.withIndex().count { it.value != target[it.index] } <= 2
}



Measured memory_bytes: 37820
/*
Author: CNYALI_LK
LANG: C++
PROG: E.cpp
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double PI=acos(-1.0);
typedef long long ll;
template<class T>void chkmin(T &a,T b){a=a<b?a:b;}
template<class T>void chkmax(T &a,T b){a=a>b?a:b;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
int fa[1010],x[1010],t[1010];
int ok[1010][5050];
int s[1010];
vector<int> to[1010];
int main(){
#ifdef cnyali_lk
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
	int n;
	scanf("%d",&n);
	for(int i=2;i<=n;++i){
		scanf("%d",fa+i);
		++s[fa[i]];
		to[fa[i]].push_back(i);
	}
	ok[0][0]=1;
	for(int i=1;i<=n;++i)
		scanf("%d",x+i);
	for(int i=n;i>=1;--i){
		if(s[i]){
			for(int j=0;j<s[i];++j){
				for(int k=0;k<=x[i];++k){
					ok[j+1][k]=0;
					if(x[to[i][j]]<=k){
						ok[j+1][k]|=ok[j][k-x[to[i][j]]];
					}
					if(t[to[i][j]]-x[to[i][j]]<=k){
						ok[j+1][k]|=ok[j][k-t[to[i][j]]+x[to[i][j]]];
					}
				}
			}
			int okay=0,sys;
			for(int k=x[i];k>=0;--k){
				if(ok[s[i]][k]){
					okay=1;
					sys=x[i]-k;
					break;
				}
			}
			if(!okay){
//				printf("%d is wrong!!!\n",i);
				printf("IMPOSSIBLE\n");
				return 0;
			}
			int j=i;
//			printf("%d_%d\n",i,sys);
			while(j){
				t[j]+=sys;
				j=fa[j];
			}

		}
		else{
///			printf("%d_%d\n",i,x[i]);
			int j=i;
			while(j){
				t[j]+=x[i];
				j=fa[j];
			}
		}
	}
	printf("POSSIBLE\n");
	return 0;
}



Measured memory_bytes: 17408
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
  int A, B, C;

  scanf("%d %d %d", &A, &B, &C);
  if (C<A && C<B) {
    printf("No\n");
  } else if (C>A && C>B) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdint.h>

#define MOD_VAL ((uint64_t)1000000007)

uint64_t hoge(uint64_t cnt) {
    uint64_t tmp = 0;
    int32_t pp; /* prev p */
    uint64_t pinc = 0; /* prev inc */
    for (int i = 0; i < cnt; i++) {
        int32_t p;
        uint64_t w;
        uint64_t inc;
        scanf("%d", &p);
        if (i == 0) {
            pp = p;
            continue;
        }
        w = (uint64_t)(p - pp);
        inc = pinc + (uint64_t)i * w;
        inc %= MOD_VAL;
        tmp += inc;
        tmp %= MOD_VAL;
        /* save as previous value */
        pp = p;
        pinc = inc;
    }
    return (uint64_t)tmp;
}

int main(void)
{
    uint64_t n, m;
    scanf("%lu %lu", &n, &m);
    printf("%lu\n", (hoge(n) * hoge(m)) % MOD_VAL);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    int N;
    int H[100000];

    cin >> N;
    rep(i, N) {
        cin >> H[i];
    }

    rep(i, N - 1) {
        if(H[i] < H[i + 1]) {
            H[i + 1]--;
        }
        if(H[i] > H[i + 1]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
using namespace std;
namespace mint {
  constexpr int md = 1e9 + 7;
  inline void add (int &a, int b) {
    a += b; if (a >= md) a -= md;
  }
  inline void sub (int &a, int b) {
    a -= b; if (a < 0) a += md;
  }
  inline int sum (int a, int b) {
    add(a, b); return a;
  }
  inline int dif (int a, int b) {
    sub(a, b); return a;
  }
  template<class... A>
  inline int prod (A... args) {
    long long ret = 1;
    for (int a : initializer_list<int>{args...}) {
      assert(a >= 0);
      ret *= a;
      ret %= md;
    }
    return (int)(ret % md);
  }
  inline void mul (int &a, int b) {
    a = prod(a, b);
  }
  inline int inv (int a) {
    a %= md;
    if(a < 0) a += md;
    int b = md, u = 0, v = 1;
    while (a) {
      int t = b / a;
      b -= a * t; swap(a, b);
      u -= v * t; swap(u, v);
    }
    assert(b == 1);
    if(u < 0) u += md;
    return u;
  }
  inline int quat (int a, int b) {
    return prod(a, inv(b));
  }
  inline void div (int& a, int b) {
    a = quat(a, b);
  }
  inline int pow (int a, long long b) {
    int res = 1;
    for (; b; b >>= 1) {
      if (b & 1) mul(res, a);
      mul(a, a);
    }
    return res;
  }
  namespace factorials {
    int sz;
    vector<int> fact, finv;
    void init (int n) {
      sz = n;
      fact.resize(n); finv.resize(n);
      fact[0] = 1;
      for (int i = 1; i < n; i++) fact[i] = prod(fact[i - 1], i);
      finv[n - 1] = inv(fact[n - 1]);
      for (int i = n - 2; i >= 0; i--) finv[i] = prod(finv[i + 1], i + 1);
    }
  }
  inline int fct (int i) {
    using namespace factorials;
    assert(0 <= i && i < sz);
    return fact[i];
  }
  inline int fnv (int i) {
    using namespace factorials;
    assert(0 <= i && i < sz);
    return finv[i];
  }
  inline int binom (int n, int k) {
    using namespace factorials;
    assert(0 <= n && n < sz);
    if (0 < k || n < k) return 0;
    return prod(fact[n], finv[k], finv[n - k]);
  }
}
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int n, A, B, C, D;
  cin >> n >> A >> B >> C >> D;
  mint::factorials::init(n + 1);
  vector<int> dp(n + 1, 0); dp[0] = 1;
  for (int i = A; i <= B; i++) {
    for (int j = n; j >= 0; j--) {
      for (int m = C; m <= D; m++) {
        if (j - i * m < 0) break;
          mint::add(dp[j], mint::prod(
          mint::fct(j),
          mint::pow(mint::fnv(i), m),
          mint::fnv(j - i * m),
          mint::fnv(m),
          dp[j - i * m]
        ));
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
info = [list(map(int,input().split())) for _ in range(N)]

def judge(Cx,Cy):
    for x, y, h in info:
        if h != 0:
            H = abs(x-Cx) + abs(y-Cy) + h
            break
    for x, y, h in info:
        if max(H-abs(x-Cx)-abs(y-Cy),0) != h:
            return
    global ans
    ans = [Cx,Cy,H]
    
for Cx in range(101):
    for Cy in range(101):
        judge(Cx,Cy)

print(*ans)

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

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

  int p[5000];
  for(int i=0; i<n; i++){
    cin >> p[i];
  }

  int min_sum=20000;

  for(int I=0; I<=p[0]; I++){
    int q[5000];
    for(int i=0; i<n; i++){
      q[i]=p[i];
    }

    int sum=I;
    q[0]-=I;

    for(int i=0; i<=n-2; i++){
      if(q[i]<=0)continue;

      sum += q[i]*2;
      q[i+1]-=q[i];
    }

    if(q[n-1]>0){
      sum +=q[n-1];
    }

    min_sum=min(min_sum, sum);
  }

  cout << min_sum << endl;

  return 0;
}


Measured memory_bytes: 3136
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(void){
    int N,K,Q ;
     int n; 
    cin >> N;
    cin >> K;
    cin >> Q;
    
    
  vector<int>sco(N,K);

     for( int i=0; i<Q; i++){
         cin>>n;
         sco[n-1]++;
     }


     for( int j=0; j < N; j++){
         if((sco[j] - Q) <=0){
             cout<<"No"<<endl;
         } else {
             cout<<"Yes"<<endl;
         }
     }
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int a[7];

int main() {
  for (int i = 0; i < 3; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = i + 1; j < 3; ++j) {
      if (a[i] > a[j]) {
        a[i] ^= a[j] ^= a[i] ^= a[j];
      }
    }
  }
  printf("%d\n", a[2] - a[0]);
  return 0;
}



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

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int q;
    cin >> q;
    for(int i = 0; i < q; ++i){
        int k;
        cin >> k;
        auto it = lower_bound(a.begin(), a.end(), k);
        if(it == a.end()){
            cout << n << endl;
        }
        else{
            cout << it - a.begin() << endl;
        }
    }

    return 0;
}


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

int main() {
  string S;
  cin >> S;

  long total{};
  for (int i{}; i < (1 << S.length()-1); ++i) {
    long num{S[0] & 0xF};
    for (int j{}; j < S.length()-1; ++j) {
      if (i & (1 << j)) {
        total += num;
        num = 0;
      }
      num *= 10;
      num += S[j+1] & 0xF;
    }
    total += num;
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int d;
  cin >> d;
  if(d==22) {
    cout << "Christmas Eve Eve Eve" << endl;
  }
  else if(d==23) {
    cout << "Christmas Eve Eve" << endl;
  }
  else if(d==24) {
    cout << "Christmas Eve" << endl;
  }
  else {
    cout << "Christmas" << endl;
  }
}

Measured memory_bytes: 256
solve :: [Int] -> [Int] -> [Int]
solve _ [_] = []
solve s1 (s:s2) = result:solve (s:s1) s2
  where result = abs $ sum (s:s1) - sum s2

main :: IO ()
main = do
  getLine
  ws <- map read . words <$> getLine
  print . minimum $ solve [] ws


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

int eval(char a)
{
    return a - '0';
}

int main(void)
{
    string a, b;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        stack<int> c;
        cin >> a >> b;
        auto ia = a.rbegin();
        auto ib = b.rbegin();
        int g = 0;
        while (true) {
            int e = 0, f = 0;
            if (ia != a.rend())
                e = eval((char)*ia++);
            if (ib != b.rend())
                f = eval((char)*ib++);
            c.push((e + f + g)%10);
            g = (e + f + g >=10)? 1 : 0;
            if (ia == a.rend() && ib == b.rend())
            {
                if (g == 1)
                    c.push(1);
                break;
            }
        }
        int l = c.size();
        if (l > 80) {
            cout << "overflow" << endl;
            continue;
        }
        for (int i = 0; i < l; ++i) {
            cout << c.top();
            c.pop();
        }
        cout << endl;
    }
    return 0;
}






Measured memory_bytes: 3212
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a[5],i,m=0,k=10,t=0;
    for(i=0;i<5;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%10<k&&a[i]%10!=0)
        {
            k=a[i]%10;
            m=i;
        }
    }
    t=a[m];
    for(i=0;i<5;i++)
    {
        if(i==m)
            continue;
        else if(a[i]%10!=0)
            t+=(a[i]+10-a[i]%10);
        else
            t+=a[i];
    }
    printf("%d",t);
    return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll a, b;
  char op;
  cin >> a >> op >> b;
  if(op == '+') cout << a+b << endl;
  else cout << a-b << endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <atcoder/all> 

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;	


using namespace std;
using namespace atcoder;

typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
 
const ll MAX = 5e6 + 100;
const ll inf = 1e9;

int main(){
	fastio;	
	ll n,q,t,u,v;
	cin >> n >> q;
	dsu d(n);
	while(q--){
		cin >> t >> u >> v;
		if(t == 0) d.merge(u,v);
		else{
			if(d.same(u,v)) cout <<"1\n";
			else cout << "0\n";
		}
	}
}

Measured memory_bytes: 3980